:root {
  --page: #080c14;
  --page-deep: #060910;
  --surface: rgba(15, 21, 33, 0.82);
  --surface-solid: #101722;
  --surface-raised: #151e2d;
  --surface-soft: rgba(255, 255, 255, 0.045);
  --surface-hover: rgba(255, 255, 255, 0.075);
  --text: #f4f6fb;
  --text-soft: #a7b0c0;
  --text-muted: #707b8e;
  --accent: #7c6df2;
  --accent-bright: #9587ff;
  --accent-blue: #4bc8ff;
  --accent-gradient: linear-gradient(135deg, #8b7cf7 0%, #6477ed 48%, #4ebcf5 100%);
  --success: #54d6a1;
  --warning: #ffbf69;
  --danger: #ff7185;
  --line: rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.12);
  --shadow-lg: 0 32px 80px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 18px 44px rgba(0, 0, 0, 0.25);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.16, 1.15, 0.3, 1);
}

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

html,
body {
  margin: 0;
  width: 100%;
  min-width: 320px;
  height: 100%;
  background: var(--page);
  color: var(--text);
  font-family: var(--font);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button,
a {
  touch-action: manipulation;
}

::selection {
  color: #fff;
  background: rgba(124, 109, 242, 0.48);
}

:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 3px;
}

.hidden {
  display: none !important;
}

.view {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
}

.ambient {
  position: fixed;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% -20%, rgba(99, 112, 217, 0.11), transparent 44%),
    linear-gradient(145deg, var(--page) 0%, var(--page-deep) 100%);
}

.ambient-orb {
  position: absolute;
  display: block;
  border-radius: 999px;
  opacity: 0.48;
  filter: blur(3px);
  will-change: transform;
}

.orb-one {
  top: -22%;
  left: -8%;
  width: min(48vw, 720px);
  aspect-ratio: 1;
  background: radial-gradient(circle, rgba(107, 87, 230, 0.28), transparent 68%);
  animation: orbFloatOne 18s ease-in-out infinite alternate;
}

.orb-two {
  right: -16%;
  bottom: -34%;
  width: min(60vw, 900px);
  aspect-ratio: 1;
  background: radial-gradient(circle, rgba(36, 151, 208, 0.22), transparent 67%);
  animation: orbFloatTwo 22s ease-in-out infinite alternate;
}

.orb-three {
  top: 32%;
  left: 46%;
  width: min(32vw, 480px);
  aspect-ratio: 1;
  background: radial-gradient(circle, rgba(109, 78, 200, 0.12), transparent 70%);
  animation: orbFloatThree 16s ease-in-out infinite alternate;
}

.ambient-grid {
  position: absolute;
  inset: 0;
  opacity: 0.12;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: linear-gradient(to bottom, black, transparent 78%);
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

@keyframes orbFloatOne {
  to { transform: translate3d(8%, 9%, 0) scale(1.08); }
}

@keyframes orbFloatTwo {
  to { transform: translate3d(-9%, -8%, 0) scale(1.04); }
}

@keyframes orbFloatThree {
  to { transform: translate3d(-12%, 12%, 0) scale(1.12); }
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 15px;
  color: #fff;
  background: var(--accent-gradient);
  box-shadow:
    0 12px 28px rgba(91, 90, 218, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.brand-mark svg {
  width: 30px;
  height: 30px;
}

.brand-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  line-height: 1.15;
}

.brand-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: 0.96rem;
  font-weight: 680;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy small {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.18em;
}

/* Login */
.login-view {
  display: grid;
  overflow: auto;
  padding: clamp(22px, 4vw, 60px);
  place-items: center;
  scrollbar-width: thin;
}

.login-shell {
  display: grid;
  width: min(100%, 1180px);
  min-height: min(760px, calc(100dvh - clamp(44px, 8vw, 120px)));
  grid-template-columns: minmax(0, 1fr) minmax(380px, 438px);
  gap: clamp(48px, 8vw, 112px);
  align-items: stretch;
}

.login-story {
  display: flex;
  min-width: 0;
  padding: clamp(12px, 2vw, 26px) 0;
  flex-direction: column;
}

.brand-large {
  animation: riseIn 0.8s 0.05s var(--ease-out) both;
}

.story-copy {
  max-width: 660px;
  margin: auto 0;
  padding: 64px 0;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 24px;
  color: #b8c1d2;
  font-size: 0.76rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  animation: riseIn 0.8s 0.15s var(--ease-out) both;
}

.eyebrow i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(84, 214, 161, 0.1), 0 0 18px rgba(84, 214, 161, 0.45);
}

.story-copy h1 {
  margin: 0;
  color: #f7f8fc;
  font-size: clamp(3.2rem, 6vw, 5.9rem);
  font-weight: 660;
  line-height: 1.04;
  letter-spacing: -0.06em;
  animation: riseIn 0.85s 0.22s var(--ease-out) both;
}

.story-copy h1 span {
  color: transparent;
  background: linear-gradient(110deg, #a99dff 0%, #7e8ffb 42%, #5bd2ff 92%);
  -webkit-background-clip: text;
  background-clip: text;
}

.story-copy > p {
  max-width: 590px;
  margin: 28px 0 0;
  color: var(--text-soft);
  font-size: clamp(1rem, 1.4vw, 1.12rem);
  line-height: 1.85;
  animation: riseIn 0.85s 0.32s var(--ease-out) both;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  animation: riseIn 0.85s 0.42s var(--ease-out) both;
}

.feature-card {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.026);
  transition: transform 0.35s var(--ease-out), border-color 0.35s ease, background 0.35s ease;
}

.feature-icon {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 11px;
  color: #a89fff;
  background: rgba(124, 109, 242, 0.1);
}

.feature-icon svg {
  width: 19px;
  height: 19px;
}

.feature-card > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.feature-card strong {
  overflow: hidden;
  color: #dfe3ec;
  font-size: 0.79rem;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feature-card small {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.67rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login-card {
  position: relative;
  align-self: center;
  overflow: hidden;
  width: 100%;
  padding: clamp(34px, 4vw, 48px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.045), transparent 42%),
    rgba(13, 19, 30, 0.84);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.035);
  -webkit-backdrop-filter: blur(26px) saturate(130%);
  backdrop-filter: blur(26px) saturate(130%);
  animation: cardIn 0.9s 0.12s var(--ease-out) both;
}

.login-card::before {
  position: absolute;
  top: 0;
  left: 12%;
  width: 76%;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(157, 144, 255, 0.72), rgba(84, 193, 245, 0.45), transparent);
}

.mobile-brand {
  display: none;
  margin-bottom: 40px;
}

.login-heading {
  margin-bottom: 32px;
}

.section-kicker {
  display: block;
  margin-bottom: 12px;
  color: #988df2;
  font-size: 0.64rem;
  font-weight: 750;
  letter-spacing: 0.19em;
}

.login-heading h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.8rem, 3vw, 2.2rem);
  font-weight: 650;
  letter-spacing: -0.045em;
}

.login-heading p {
  margin: 12px 0 0;
  color: var(--text-soft);
  font-size: 0.88rem;
  line-height: 1.65;
}

.field {
  display: block;
  margin-bottom: 18px;
}

.field-label {
  display: block;
  margin: 0 0 8px 2px;
  color: #c2c8d4;
  font-size: 0.76rem;
  font-weight: 590;
}

.input-shell {
  position: relative;
  display: flex;
  height: 54px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(4, 8, 14, 0.46);
  transition:
    border-color 0.25s ease,
    background 0.25s ease,
    box-shadow 0.25s ease,
    transform 0.25s var(--ease-out);
}

.input-shell:focus-within {
  border-color: rgba(143, 127, 255, 0.68);
  background: rgba(7, 11, 20, 0.78);
  box-shadow: 0 0 0 4px rgba(124, 109, 242, 0.09), 0 12px 32px rgba(0, 0, 0, 0.13);
  transform: translateY(-1px);
}

.input-shell > svg {
  width: 19px;
  height: 19px;
  margin-left: 16px;
  flex: 0 0 auto;
  color: var(--text-muted);
  transition: color 0.25s ease;
}

.input-shell:focus-within > svg {
  color: var(--accent-bright);
}

.input-shell input {
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 0 15px 1px 12px;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  caret-color: var(--accent-bright);
  font-size: 0.92rem;
}

.input-shell input::placeholder {
  color: #626c7d;
}

.password-toggle {
  display: grid;
  width: 42px;
  height: 42px;
  margin-right: 5px;
  flex: 0 0 auto;
  cursor: pointer;
  place-items: center;
  border: 0;
  border-radius: 11px;
  color: var(--text-muted);
  background: transparent;
  transition: color 0.2s ease, background 0.2s ease;
}

.password-toggle svg {
  width: 19px;
  height: 19px;
}

.password-toggle .eye-closed,
.password-toggle.is-visible .eye-open {
  display: none;
}

.password-toggle.is-visible .eye-closed {
  display: block;
}

.error {
  margin: -3px 2px 14px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 113, 133, 0.2);
  border-radius: 11px;
  color: #ff9bab;
  background: rgba(255, 113, 133, 0.07);
  font-size: 0.78rem;
  line-height: 1.5;
  animation: errorIn 0.35s var(--ease-spring) both;
}

.login-form-error {
  animation: formShake 0.42s ease;
}

.login-button {
  position: relative;
  display: flex;
  overflow: hidden;
  width: 100%;
  height: 54px;
  margin-top: 8px;
  align-items: center;
  justify-content: center;
  gap: 11px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 15px;
  color: #fff;
  background: var(--accent-gradient);
  box-shadow: 0 15px 32px rgba(86, 90, 217, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  font-size: 0.9rem;
  font-weight: 650;
  transition: transform 0.28s var(--ease-out), box-shadow 0.28s ease, filter 0.28s ease;
}

.login-button::before {
  position: absolute;
  inset: 0;
  content: "";
  opacity: 0;
  background: linear-gradient(110deg, transparent 24%, rgba(255, 255, 255, 0.22) 44%, transparent 64%);
  transform: translateX(-80%);
  transition: opacity 0.25s ease;
}

.button-label,
.button-arrow {
  position: relative;
  transition: opacity 0.2s ease, transform 0.25s var(--ease-out);
}

.button-arrow {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
}

.button-arrow svg {
  width: 18px;
  height: 18px;
}

.button-spinner {
  position: absolute;
  width: 20px;
  height: 20px;
  opacity: 0;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.login-button.is-loading .button-label,
.login-button.is-loading .button-arrow {
  opacity: 0;
  transform: translateY(4px);
}

.login-button.is-loading .button-spinner {
  opacity: 1;
}

.login-button:disabled {
  cursor: wait;
  filter: saturate(0.78);
}

.privacy-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  color: var(--text-muted);
  font-size: 0.69rem;
  line-height: 1.45;
  text-align: center;
}

.privacy-note svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: #7c8ca6;
}

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

@keyframes cardIn {
  from { opacity: 0; transform: translateY(24px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes errorIn {
  from { opacity: 0; transform: translateY(-5px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes formShake {
  20% { transform: translateX(-5px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

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

/* Chat workspace */
.chat-view {
  padding: 18px;
  animation: chatReveal 0.65s var(--ease-out) both;
}

.workspace {
  display: grid;
  width: min(100%, 1440px);
  height: calc(100dvh - 36px);
  margin: 0 auto;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: 14px;
}

.sidebar,
.chat-surface {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.025);
  -webkit-backdrop-filter: blur(24px) saturate(125%);
  backdrop-filter: blur(24px) saturate(125%);
}

.sidebar {
  display: flex;
  min-height: 0;
  padding: 18px;
  border-radius: var(--radius-xl);
  flex-direction: column;
  animation: sidebarIn 0.7s 0.04s var(--ease-out) both;
}

.sidebar-brand {
  padding: 3px 4px 23px;
  border-bottom: 1px solid var(--line);
}

.sidebar-brand .brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
}

.sidebar-brand .brand-mark svg {
  width: 27px;
  height: 27px;
}

.sidebar-section {
  padding-top: 23px;
}

.sidebar-label {
  display: block;
  margin: 0 10px 10px;
  color: #606b7d;
  font-size: 0.63rem;
  font-weight: 720;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.room-item {
  display: flex;
  width: 100%;
  min-width: 0;
  padding: 10px;
  align-items: center;
  gap: 11px;
  cursor: default;
  border: 1px solid transparent;
  border-radius: 16px;
  color: var(--text);
  text-align: left;
  background: transparent;
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s var(--ease-out);
}

.room-item.active {
  border-color: rgba(142, 126, 255, 0.12);
  background: linear-gradient(115deg, rgba(124, 109, 242, 0.13), rgba(76, 174, 230, 0.055));
}

.room-avatar {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(152, 139, 255, 0.16);
  border-radius: 14px;
  color: #a99fff;
  background: rgba(124, 109, 242, 0.12);
}

.room-avatar svg {
  width: 21px;
  height: 21px;
}

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

.room-copy strong {
  overflow: hidden;
  font-size: 0.83rem;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-copy small {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.67rem;
}

.room-chevron {
  color: #657084;
  font-size: 1.25rem;
  font-weight: 300;
}

.sidebar-spacer {
  min-height: 20px;
  flex: 1;
}

.retention-card {
  position: relative;
  overflow: hidden;
  margin-bottom: 14px;
  padding: 17px;
  border: 1px solid rgba(124, 109, 242, 0.13);
  border-radius: 17px;
  background:
    radial-gradient(circle at 100% 0, rgba(88, 179, 229, 0.12), transparent 45%),
    rgba(124, 109, 242, 0.07);
}

.retention-icon {
  display: grid;
  width: 34px;
  height: 34px;
  margin-bottom: 14px;
  place-items: center;
  border-radius: 10px;
  color: #9e93f9;
  background: rgba(124, 109, 242, 0.12);
}

.retention-icon svg {
  width: 18px;
  height: 18px;
}

.retention-card strong {
  color: #dfe3ed;
  font-size: 0.78rem;
  font-weight: 630;
}

.retention-card p {
  margin: 7px 0 0;
  color: var(--text-muted);
  font-size: 0.67rem;
  line-height: 1.65;
}

.user-card {
  display: flex;
  min-width: 0;
  padding: 8px 7px 8px 9px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.027);
}

.user-avatar,
.message-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: #f4f1ff;
  background:
    linear-gradient(135deg, hsla(var(--avatar-hue, 252), 72%, 68%, 0.88), hsla(calc(var(--avatar-hue, 252) + 45), 72%, 54%, 0.88));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
  font-weight: 680;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  font-size: 0.76rem;
}

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

.user-copy small {
  color: var(--text-muted);
  font-size: 0.6rem;
}

.user-copy strong {
  overflow: hidden;
  color: #dfe3ec;
  font-size: 0.76rem;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  cursor: pointer;
  place-items: center;
  border: 0;
  border-radius: 13px;
  color: var(--text-muted);
  background: transparent;
  transition: color 0.22s ease, background 0.22s ease, transform 0.22s var(--ease-out);
}

.icon-btn svg {
  width: 21px;
  height: 21px;
}

.icon-btn:disabled {
  cursor: wait;
  opacity: 0.42;
}

.logout-button {
  width: 36px;
  height: 36px;
  border-radius: 11px;
}

.logout-button svg {
  width: 18px;
  height: 18px;
}

.chat-surface {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  grid-template-rows: 72px minmax(0, 1fr) auto;
  border-radius: var(--radius-xl);
  animation: chatPanelIn 0.72s 0.08s var(--ease-out) both;
}

.chat-header {
  position: relative;
  z-index: 8;
  display: flex;
  min-width: 0;
  padding: 0 clamp(18px, 2.5vw, 30px);
  align-items: center;
  gap: 13px;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 19, 30, 0.8);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.chat-room-avatar {
  display: grid;
  width: 43px;
  height: 43px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(145, 131, 255, 0.14);
  border-radius: 14px;
  color: #a99fff;
  background: linear-gradient(145deg, rgba(124, 109, 242, 0.17), rgba(58, 153, 211, 0.09));
}

.chat-room-avatar svg {
  width: 22px;
  height: 22px;
}

.header-info {
  min-width: 0;
  flex: 1;
}

.header-title {
  overflow: hidden;
  color: #edf0f6;
  font-size: 0.92rem;
  font-weight: 640;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-sub {
  display: flex;
  min-width: 0;
  margin-top: 5px;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sub-divider {
  opacity: 0.5;
}

.presence-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(84, 214, 161, 0.1), 0 0 10px rgba(84, 214, 161, 0.3);
}

.presence-dot.connecting {
  background: var(--warning);
  box-shadow: 0 0 0 3px rgba(255, 191, 105, 0.1);
  animation: statusPulse 1.4s ease-in-out infinite;
}

.presence-dot.offline {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(255, 113, 133, 0.1);
  animation: none;
}

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

.retention-pill {
  display: inline-flex;
  height: 32px;
  padding: 0 12px;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #8f99aa;
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.66rem;
  font-weight: 560;
}

.retention-pill svg {
  width: 14px;
  height: 14px;
  color: #9b90f6;
}

.mobile-logout {
  display: none;
}

@keyframes statusPulse {
  50% { opacity: 0.48; transform: scale(0.82); }
}

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

@keyframes sidebarIn {
  from { opacity: 0; transform: translateX(-18px); }
  to { opacity: 1; transform: translateX(0); }
}

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

/* Messages */
.messages {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 26px clamp(18px, 3.8vw, 52px) 30px;
  flex-direction: column;
  gap: 7px;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
  scrollbar-width: thin;
  background:
    radial-gradient(circle at 5% 15%, rgba(124, 109, 242, 0.06), transparent 31%),
    radial-gradient(circle at 94% 86%, rgba(64, 170, 221, 0.055), transparent 32%),
    linear-gradient(180deg, rgba(7, 11, 18, 0.38), rgba(8, 13, 21, 0.62));
}

.messages::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  min-height: 100%;
  content: "";
  opacity: 0.19;
  background-image: radial-gradient(rgba(255, 255, 255, 0.1) 0.7px, transparent 0.7px);
  background-size: 18px 18px;
  pointer-events: none;
}

.messages::-webkit-scrollbar {
  width: 6px;
}

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

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

.timeline-note {
  display: inline-flex;
  align-self: center;
  margin: 0 0 18px;
  padding: 7px 11px;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-muted);
  background: rgba(10, 15, 24, 0.72);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.13);
  font-size: 0.65rem;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.timeline-note svg {
  width: 13px;
  height: 13px;
  color: #9388ed;
}

.empty-state {
  display: flex;
  max-width: 360px;
  margin: auto;
  padding: 36px 20px 72px;
  align-items: center;
  flex-direction: column;
  color: var(--text-muted);
  text-align: center;
  animation: emptyIn 0.7s 0.15s var(--ease-out) both;
}

.empty-visual {
  position: relative;
  display: grid;
  width: 74px;
  height: 74px;
  margin-bottom: 20px;
  place-items: center;
  border: 1px solid rgba(142, 127, 255, 0.15);
  border-radius: 24px;
  color: #a69bf9;
  background: linear-gradient(145deg, rgba(124, 109, 242, 0.15), rgba(76, 178, 229, 0.06));
  box-shadow: 0 18px 46px rgba(54, 49, 130, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.empty-visual::after {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 14px;
  height: 14px;
  content: "";
  border: 4px solid #101722;
  border-radius: 50%;
  background: var(--success);
}

.empty-visual svg {
  width: 32px;
  height: 32px;
}

.empty-state strong {
  margin-bottom: 8px;
  color: #d8dde7;
  font-size: 0.92rem;
  font-weight: 620;
}

.empty-state p {
  margin: 0;
  font-size: 0.73rem;
  line-height: 1.65;
}

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

.day-sep {
  align-self: center;
  margin: 12px 0;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-muted);
  background: rgba(8, 12, 20, 0.68);
  font-size: 0.66rem;
}

.msg {
  display: flex;
  width: fit-content;
  max-width: min(76%, 680px);
  align-items: flex-end;
  gap: 9px;
}

.msg.in {
  align-self: flex-start;
}

.msg.out {
  align-self: flex-end;
  justify-content: flex-end;
}

.msg.system {
  max-width: 88%;
  margin: 7px 0;
  align-self: center;
}

.msg.message-enter.in {
  animation: messageInLeft 0.46s var(--ease-spring) both;
}

.msg.message-enter.out {
  animation: messageInRight 0.46s var(--ease-spring) both;
}

.msg.message-enter.system {
  animation: messageFade 0.38s var(--ease-out) both;
}

.message-avatar {
  width: 31px;
  height: 31px;
  margin-bottom: 2px;
  border-radius: 10px;
  font-size: 0.65rem;
}

.message-content {
  min-width: 0;
}

.bubble {
  position: relative;
  min-width: 54px;
  padding: 10px 12px 7px;
  border: 1px solid var(--line);
  border-radius: 18px 18px 18px 6px;
  color: #e9edf4;
  background: rgba(22, 30, 43, 0.94);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.025);
  word-break: break-word;
}

.msg.out .bubble {
  border-color: rgba(166, 155, 255, 0.2);
  border-radius: 18px 18px 6px 18px;
  color: #fff;
  background: linear-gradient(138deg, rgba(119, 103, 232, 0.96), rgba(77, 109, 220, 0.96));
  box-shadow: 0 10px 28px rgba(54, 57, 154, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.msg.system .bubble {
  min-width: 0;
  padding: 6px 11px;
  border-color: var(--line);
  border-radius: 999px;
  color: var(--text-muted);
  background: rgba(8, 13, 21, 0.68);
  box-shadow: none;
  font-size: 0.68rem;
  line-height: 1.5;
  text-align: center;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.bubble.has-media {
  padding: 5px 5px 7px;
}

.bubble.has-media .nick,
.bubble.has-media .text {
  margin-right: 7px;
  margin-left: 7px;
}

.bubble.has-media .meta {
  margin-right: 6px;
}

.bubble .nick {
  margin: 0 0 5px;
  color: #9e93f7;
  font-size: 0.69rem;
  font-weight: 670;
  letter-spacing: 0.005em;
}

.msg.out .bubble .nick {
  color: rgba(255, 255, 255, 0.78);
}

.bubble .text {
  color: inherit;
  font-size: 0.89rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.bubble .meta {
  display: flex;
  margin-top: 4px;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  color: rgba(180, 189, 204, 0.58);
  font-size: 0.6rem;
  line-height: 1;
  user-select: none;
}

.msg.out .bubble .meta {
  color: rgba(255, 255, 255, 0.58);
}

.meta-check {
  width: 12px;
  height: 12px;
}

@keyframes messageInLeft {
  from { opacity: 0; transform: translate3d(-8px, 10px, 0) scale(0.975); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes messageInRight {
  from { opacity: 0; transform: translate3d(8px, 10px, 0) scale(0.975); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

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

/* Media and files */
.media-wrap {
  position: relative;
  overflow: hidden;
  max-width: 100%;
  margin: 0 0 6px;
  border-radius: 14px;
  cursor: zoom-in;
  background: #070a0f;
}

.media-wrap::after {
  position: absolute;
  inset: 0;
  content: "";
  opacity: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.22), transparent 46%);
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.media-wrap img,
.media-wrap video {
  display: block;
  max-width: 100%;
  max-height: min(390px, 48vh);
  border-radius: inherit;
  object-fit: contain;
}

.media-wrap img {
  transition: transform 0.45s var(--ease-out), filter 0.35s ease;
}

.media-wrap[role="button"]:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 3px;
}

.media-wrap video {
  background: #05070b;
}

.file-card {
  display: flex;
  min-width: min(300px, 62vw);
  padding: 4px 1px 6px;
  align-items: center;
  gap: 11px;
}

.file-icon {
  position: relative;
  display: grid;
  width: 43px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(139, 124, 247, 0.16);
  border-radius: 12px;
  color: #afa6fb;
  background: rgba(124, 109, 242, 0.11);
  font-size: 0.58rem;
  font-weight: 760;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.file-icon::after {
  position: absolute;
  top: 0;
  right: 0;
  width: 10px;
  height: 10px;
  content: "";
  background: linear-gradient(225deg, rgba(255, 255, 255, 0.2) 50%, transparent 51%);
}

.msg.out .file-icon {
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.file-info {
  min-width: 0;
  flex: 1;
}

.file-name {
  overflow: hidden;
  color: inherit;
  font-size: 0.8rem;
  font-weight: 580;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 0.64rem;
}

.msg.out .file-size {
  color: rgba(255, 255, 255, 0.55);
}

.file-dl {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(143, 127, 255, 0.16);
  border-radius: 11px;
  color: #a79cf9;
  background: rgba(124, 109, 242, 0.08);
  text-decoration: none;
  transition: color 0.22s ease, background 0.22s ease, transform 0.22s var(--ease-out);
}

.file-dl svg {
  width: 17px;
  height: 17px;
}

.msg.out .file-dl {
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* Composer */
.composer-zone {
  position: relative;
  z-index: 7;
  padding: 11px clamp(14px, 2.8vw, 30px) max(16px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(12, 18, 28, 0.9);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.preview-bar {
  display: flex;
  width: min(100%, 900px);
  margin: 0 auto 9px;
  padding: 9px 10px;
  align-items: center;
  gap: 11px;
  border: 1px solid rgba(142, 127, 255, 0.16);
  border-radius: 15px;
  background: linear-gradient(110deg, rgba(124, 109, 242, 0.1), rgba(58, 145, 199, 0.045));
  animation: attachmentIn 0.4s var(--ease-spring) both;
}

.preview-icon {
  display: grid;
  width: 35px;
  height: 35px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  color: #a79cf8;
  background: rgba(124, 109, 242, 0.11);
}

.preview-icon svg {
  width: 18px;
  height: 18px;
}

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

.preview-copy small {
  display: block;
  margin-bottom: 3px;
  color: #8f84e6;
  font-size: 0.58rem;
  font-weight: 690;
  letter-spacing: 0.08em;
}

.preview-label {
  overflow: hidden;
  color: #bac1ce;
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-cancel {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.preview-cancel svg {
  width: 17px;
  height: 17px;
}

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

.composer {
  display: flex;
  width: min(100%, 900px);
  min-height: 58px;
  margin: 0 auto;
  padding: 6px;
  align-items: flex-end;
  gap: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: rgba(20, 28, 41, 0.92);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.025);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s var(--ease-out);
}

.composer:focus-within {
  border-color: rgba(144, 129, 255, 0.3);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.23), 0 0 0 3px rgba(124, 109, 242, 0.045);
}

.attach {
  width: 45px;
  height: 45px;
  margin-bottom: 0;
  border-radius: 14px;
}

.composer-input-wrap {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 45px;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  padding: 8px 5px 5px;
}

.composer-input-wrap textarea {
  display: block;
  width: 100%;
  height: 22px;
  max-height: 140px;
  min-height: 22px;
  padding: 0;
  resize: none;
  overflow-y: auto;
  border: 0;
  outline: 0;
  color: #e9edf4;
  background: transparent;
  caret-color: var(--accent-bright);
  font-size: 0.86rem;
  line-height: 1.55;
  scrollbar-width: thin;
}

.composer-input-wrap textarea::placeholder {
  color: #657083;
}

.composer-hint {
  display: block;
  margin-top: 3px;
  color: #515c6e;
  font-size: 0.55rem;
  line-height: 1;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.composer:focus-within .composer-hint {
  opacity: 0.78;
}

.send-btn {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  cursor: pointer;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 15px;
  color: #fff;
  background: var(--accent-gradient);
  box-shadow: 0 10px 24px rgba(75, 75, 187, 0.23), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: transform 0.25s var(--ease-spring), box-shadow 0.25s ease, opacity 0.25s ease, filter 0.25s ease;
}

.send-btn svg {
  width: 21px;
  height: 21px;
  transition: transform 0.3s var(--ease-spring);
}

.send-btn:disabled {
  cursor: default;
  opacity: 0.34;
  filter: saturate(0.45);
  box-shadow: none;
}

.scroll-latest {
  position: absolute;
  z-index: 10;
  right: clamp(22px, 3.5vw, 46px);
  bottom: 98px;
  display: inline-flex;
  height: 37px;
  padding: 0 12px 0 9px;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: #cbd1dd;
  background: rgba(17, 24, 36, 0.9);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
  font-size: 0.67rem;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  animation: latestIn 0.35s var(--ease-spring) both;
}

.scroll-latest svg {
  width: 16px;
  height: 16px;
  color: #9f94f8;
}

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

.upload-progress {
  position: absolute;
  z-index: 20;
  right: 22px;
  bottom: 101px;
  width: min(330px, calc(100% - 44px));
  padding: 13px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  color: #c3cad5;
  background: rgba(17, 24, 36, 0.95);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.3);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  animation: uploadIn 0.38s var(--ease-spring) both;
}

.upload-status-row {
  display: flex;
  min-width: 0;
  margin-bottom: 10px;
  align-items: center;
  gap: 9px;
  font-size: 0.68rem;
}

.upload-status-row span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-spinner {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border: 2px solid rgba(157, 143, 255, 0.2);
  border-top-color: #9d8fff;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.upload-track {
  overflow: hidden;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.07);
}

.upload-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent-gradient);
  box-shadow: 0 0 14px rgba(124, 109, 242, 0.42);
  transition: width 0.2s ease;
}

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

.drop-overlay {
  position: absolute;
  z-index: 50;
  inset: 8px;
  display: grid;
  visibility: hidden;
  opacity: 0;
  place-items: center;
  border: 1px dashed rgba(155, 142, 255, 0.4);
  border-radius: 22px;
  background: rgba(8, 12, 20, 0.84);
  -webkit-backdrop-filter: blur(22px);
  backdrop-filter: blur(22px);
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.chat-surface.is-dragging .drop-overlay {
  visibility: visible;
  opacity: 1;
}

.drop-card {
  display: flex;
  align-items: center;
  flex-direction: column;
  text-align: center;
  transform: translateY(8px) scale(0.96);
  transition: transform 0.35s var(--ease-spring);
}

.chat-surface.is-dragging .drop-card {
  transform: translateY(0) scale(1);
}

.drop-card > span {
  display: grid;
  width: 68px;
  height: 68px;
  margin-bottom: 18px;
  place-items: center;
  border: 1px solid rgba(153, 140, 255, 0.2);
  border-radius: 22px;
  color: #a79cf9;
  background: rgba(124, 109, 242, 0.12);
  box-shadow: 0 18px 40px rgba(54, 49, 130, 0.15);
}

.drop-card svg {
  width: 29px;
  height: 29px;
}

.drop-card strong {
  color: #e5e8f0;
  font-size: 1rem;
  font-weight: 630;
}

.drop-card small {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 0.71rem;
}

/* Lightbox */
.lightbox {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  padding: 62px 24px 24px;
  place-items: center;
  animation: lightboxFade 0.3s ease both;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 5, 9, 0.9);
  -webkit-backdrop-filter: blur(20px) saturate(85%);
  backdrop-filter: blur(20px) saturate(85%);
}

.lightbox-close {
  position: absolute;
  z-index: 2;
  top: max(16px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  display: grid;
  width: 42px;
  height: 42px;
  cursor: pointer;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 14px;
  color: #e8ebf2;
  background: rgba(255, 255, 255, 0.06);
  transition: background 0.22s ease, transform 0.22s var(--ease-out);
}

.lightbox-close svg {
  width: 20px;
  height: 20px;
}

.lightbox-body {
  position: relative;
  z-index: 1;
  display: flex;
  max-width: 100%;
  max-height: 100%;
  align-items: center;
  justify-content: center;
  animation: mediaZoom 0.42s var(--ease-out) both;
}

.lightbox-body img,
.lightbox-body video {
  display: block;
  max-width: min(100%, 1400px);
  max-height: calc(100dvh - 92px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: #05070b;
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.55);
  object-fit: contain;
}

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

@keyframes mediaZoom {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

/* Toasts */
.toast-region {
  position: fixed;
  z-index: 200;
  top: max(20px, env(safe-area-inset-top));
  right: max(20px, env(safe-area-inset-right));
  display: flex;
  width: min(360px, calc(100% - 40px));
  align-items: flex-end;
  flex-direction: column;
  gap: 9px;
  pointer-events: none;
}

.toast {
  display: flex;
  width: 100%;
  padding: 12px 14px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  color: #dfe3ec;
  background: rgba(19, 27, 40, 0.95);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.3);
  font-size: 0.74rem;
  line-height: 1.45;
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  pointer-events: auto;
  animation: toastIn 0.4s var(--ease-spring) both;
}

.toast.is-leaving {
  animation: toastOut 0.25s ease both;
}

.toast-icon {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 9px;
  color: #ff9cac;
  background: rgba(255, 113, 133, 0.1);
}

.toast.success .toast-icon {
  color: #77e1b6;
  background: rgba(84, 214, 161, 0.1);
}

.toast-icon svg {
  width: 15px;
  height: 15px;
}

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

@keyframes toastOut {
  to { opacity: 0; transform: translateX(12px) scale(0.97); }
}

/* Hover interactions */
@media (hover: hover) {
  .feature-card:hover {
    border-color: rgba(143, 128, 255, 0.18);
    background: rgba(255, 255, 255, 0.04);
    transform: translateY(-3px);
  }

  .password-toggle:hover,
  .icon-btn:hover {
    color: #d9dee8;
    background: var(--surface-hover);
  }

  .logout-button:hover,
  .mobile-logout:hover {
    color: #ff93a3;
    background: rgba(255, 113, 133, 0.09);
  }

  .login-button:hover:not(:disabled) {
    box-shadow: 0 18px 38px rgba(86, 90, 217, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.24);
    filter: brightness(1.06);
    transform: translateY(-2px);
  }

  .login-button:hover:not(:disabled)::before {
    opacity: 1;
    animation: buttonShine 1s ease forwards;
  }

  .login-button:hover:not(:disabled) .button-arrow {
    transform: translateX(3px);
  }

  .room-item:hover {
    border-color: rgba(142, 126, 255, 0.16);
    background: linear-gradient(115deg, rgba(124, 109, 242, 0.16), rgba(76, 174, 230, 0.07));
  }

  .attach:hover {
    color: #aaa0fa;
    background: rgba(124, 109, 242, 0.1);
    transform: rotate(-8deg);
  }

  .send-btn:hover:not(:disabled) {
    box-shadow: 0 13px 30px rgba(75, 75, 187, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translateY(-2px) scale(1.02);
  }

  .send-btn:hover:not(:disabled) svg {
    transform: translate(1px, -1px) rotate(-3deg);
  }

  .media-wrap:hover::after {
    opacity: 1;
  }

  .media-wrap:hover img {
    filter: brightness(1.04);
    transform: scale(1.018);
  }

  .file-dl:hover {
    color: #fff;
    background: rgba(124, 109, 242, 0.2);
    transform: translateY(-1px);
  }

  .scroll-latest:hover {
    border-color: rgba(151, 138, 255, 0.25);
    background: rgba(24, 32, 47, 0.96);
  }

  .lightbox-close:hover {
    background: rgba(255, 255, 255, 0.11);
    transform: rotate(4deg) scale(1.04);
  }
}

.login-button:active:not(:disabled),
.send-btn:active:not(:disabled),
.icon-btn:active,
.file-dl:active {
  transform: scale(0.96);
}

@keyframes buttonShine {
  to { transform: translateX(85%); }
}

/* Responsive */
@media (max-width: 1080px) {
  .login-shell {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 410px);
    gap: 48px;
  }

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

  .feature-card:last-child {
    display: none;
  }

  .workspace {
    grid-template-columns: 238px minmax(0, 1fr);
  }

  .sidebar {
    padding: 15px;
  }
}

@media (max-width: 860px) {
  .login-view {
    padding: 28px 20px;
  }

  .login-shell {
    width: min(100%, 450px);
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .login-story {
    display: none;
  }

  .mobile-brand {
    display: flex;
  }

  .chat-view {
    padding: 0;
  }

  .workspace {
    display: block;
    width: 100%;
    height: 100dvh;
  }

  .sidebar {
    display: none;
  }

  .chat-surface {
    width: 100%;
    height: 100dvh;
    grid-template-rows: max(66px, calc(58px + env(safe-area-inset-top))) minmax(0, 1fr) auto;
    border: 0;
    border-radius: 0;
    background: rgba(11, 17, 27, 0.9);
    animation: chatReveal 0.45s ease both;
  }

  .chat-header {
    padding-top: env(safe-area-inset-top);
  }

  .mobile-logout {
    display: grid;
  }
}

@media (max-width: 600px) {
  .login-view {
    align-items: start;
    padding: max(22px, env(safe-area-inset-top)) 14px max(22px, env(safe-area-inset-bottom));
  }

  .login-card {
    margin: auto 0;
    padding: 30px 22px 26px;
    border-radius: 24px;
  }

  .mobile-brand {
    margin-bottom: 34px;
  }

  .mobile-brand .brand-mark {
    width: 43px;
    height: 43px;
    border-radius: 14px;
  }

  .login-heading {
    margin-bottom: 26px;
  }

  .chat-header {
    padding-right: 12px;
    padding-left: 14px;
    gap: 10px;
  }

  .chat-room-avatar {
    width: 40px;
    height: 40px;
    border-radius: 13px;
  }

  .retention-pill {
    display: none;
  }

  .messages {
    padding: 19px 11px 24px;
    gap: 6px;
  }

  .timeline-note {
    margin-bottom: 13px;
  }

  .empty-state {
    padding-bottom: 38px;
  }

  .msg {
    max-width: 89%;
    gap: 6px;
  }

  .message-avatar {
    width: 27px;
    height: 27px;
    border-radius: 9px;
    font-size: 0.58rem;
  }

  .bubble {
    padding: 9px 11px 7px;
    border-radius: 16px 16px 16px 5px;
  }

  .msg.out .bubble {
    border-radius: 16px 16px 5px 16px;
  }

  .bubble .text {
    font-size: 0.86rem;
  }

  .file-card {
    min-width: min(255px, 66vw);
  }

  .file-icon {
    width: 40px;
    height: 44px;
  }

  .composer-zone {
    padding: 8px 8px max(9px, env(safe-area-inset-bottom));
  }

  .composer {
    min-height: 56px;
    border-radius: 18px;
  }

  .composer-hint {
    display: none;
  }

  .composer-input-wrap {
    min-height: 43px;
    padding: 10px 3px;
  }

  .attach {
    width: 43px;
    height: 43px;
  }

  .send-btn {
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }

  .preview-bar {
    margin-bottom: 7px;
  }

  .scroll-latest {
    right: 14px;
    bottom: calc(80px + env(safe-area-inset-bottom));
  }

  .upload-progress {
    right: 12px;
    bottom: calc(82px + env(safe-area-inset-bottom));
    width: calc(100% - 24px);
  }

  .lightbox {
    padding: 58px 10px 14px;
  }

  .lightbox-body img,
  .lightbox-body video {
    max-height: calc(100dvh - 76px);
    border-radius: 12px;
  }

  .toast-region {
    top: max(12px, env(safe-area-inset-top));
    right: 12px;
    width: calc(100% - 24px);
  }
}

@media (max-width: 380px) {
  .login-card {
    padding-right: 18px;
    padding-left: 18px;
  }

  .privacy-note svg {
    display: none;
  }

  .message-avatar {
    display: none;
  }

  .msg {
    max-width: 92%;
  }
}

@media (max-height: 680px) and (min-width: 861px) {
  .login-shell {
    min-height: calc(100dvh - 44px);
  }

  .story-copy {
    padding: 34px 0;
  }

  .story-copy h1 {
    font-size: clamp(3rem, 5.3vw, 4.5rem);
  }

  .login-card {
    padding-top: 32px;
    padding-bottom: 28px;
  }

  .login-heading {
    margin-bottom: 24px;
  }

  .field {
    margin-bottom: 14px;
  }

  .privacy-note {
    margin-top: 18px;
  }
}

@media (prefers-contrast: more) {
  :root {
    --line: rgba(255, 255, 255, 0.16);
    --line-strong: rgba(255, 255, 255, 0.23);
    --text-muted: #929dad;
  }
}

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

::view-transition-old(root) {
  animation: viewOut 0.28s ease both;
}

::view-transition-new(root) {
  animation: viewIn 0.42s var(--ease-out) both;
}

@keyframes viewOut {
  to { opacity: 0; transform: scale(0.99); }
}

@keyframes viewIn {
  from { opacity: 0; transform: scale(1.008); }
}

/* ---------- Auth multi-panel ---------- */
.auth-panel { display: flex; flex-direction: column; gap: 1rem; }
.auth-switch {
  margin: 0.25rem 0 0;
  text-align: center;
  color: var(--muted, #8b95a8);
  font-size: 0.92rem;
}
.link-btn {
  background: none;
  border: none;
  color: #8b9cff;
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link-btn:hover { color: #b4beff; }
.secondary-btn {
  background: rgba(255,255,255,0.06) !important;
  box-shadow: none !important;
}
.secondary-btn::before { display: none !important; }
.check-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted, #8b95a8);
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
}
.check-row input { accent-color: #7b6cff; width: 1rem; height: 1rem; }
.totp-qr {
  display: flex;
  justify-content: center;
  padding: 0.75rem;
  border-radius: var(--radius-md, 16px);
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.06);
}
.totp-qr svg { width: 180px; height: 180px; border-radius: 12px; }
.totp-secret-box { display: flex; flex-direction: column; gap: 0.35rem; }
.totp-secret {
  display: block;
  word-break: break-all;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
  letter-spacing: 0.04em;
  color: #d7def0;
}
.recovery-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  border-radius: var(--radius-md, 16px);
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(255,255,255,0.06);
}
.recovery-list li {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  text-align: center;
  letter-spacing: 0.04em;
}
.recover-details {
  margin-top: 0.25rem;
  color: var(--muted, #8b95a8);
  font-size: 0.9rem;
}
.recover-details summary { cursor: pointer; color: #8b9cff; }
.recover-form { margin-top: 0.75rem; display: flex; flex-direction: column; gap: 0.75rem; }
.admin-link { color: #8b9cff; text-decoration: none; }
.admin-link:hover { color: #c5cbff; }

/* ---------- Admin page ---------- */
.admin-page {
  min-height: 100%;
  padding: 1.5rem clamp(1rem, 3vw, 2.5rem) 3rem;
  position: relative;
  z-index: 1;
}
.admin-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.admin-header h1 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.admin-header p {
  margin: 0.25rem 0 0;
  color: var(--muted, #8b95a8);
  font-size: 0.92rem;
}
.admin-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.admin-btn {
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: var(--text, #e8edf7);
  border-radius: 12px;
  padding: 0.55rem 0.95rem;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.admin-btn:hover { background: rgba(255,255,255,0.09); }
.admin-btn.primary {
  background: linear-gradient(135deg, #7167ec, #4aa8ff);
  border-color: transparent;
  color: white;
  font-weight: 600;
}
.admin-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.admin-tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted, #8b95a8);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}
.admin-tab.active {
  background: rgba(123, 108, 255, 0.15);
  color: #c5cbff;
  border-color: rgba(123, 108, 255, 0.35);
}
.admin-card {
  border-radius: var(--radius-lg, 22px);
  background: rgba(16, 20, 32, 0.72);
  border: 1px solid rgba(255,255,255,0.07);
  box-shadow: var(--shadow-md, 0 18px 44px rgba(0,0,0,0.25));
  overflow: hidden;
  backdrop-filter: blur(18px);
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.admin-table th,
.admin-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  vertical-align: middle;
}
.admin-table th {
  color: var(--muted, #8b95a8);
  font-weight: 550;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table .ops {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.admin-table .ops button {
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: #d7def0;
  border-radius: 8px;
  padding: 0.3rem 0.55rem;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}
.admin-table .ops button:hover { background: rgba(255,255,255,0.1); }
.admin-table .ops button.danger { color: #ff9b9b; border-color: rgba(255,120,120,0.25); }
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255,255,255,0.06);
  color: #c5cbd8;
}
.badge.pending { background: rgba(255, 196, 86, 0.15); color: #ffd27a; }
.badge.active { background: rgba(72, 210, 150, 0.15); color: #7dffc0; }
.badge.rejected, .badge.disabled { background: rgba(255, 100, 100, 0.12); color: #ff9b9b; }
.badge.unbound { background: rgba(123, 108, 255, 0.15); color: #c5cbff; }
.admin-empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--muted, #8b95a8);
}
.admin-error {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: rgba(255, 80, 80, 0.12);
  color: #ffb4b4;
  border: 1px solid rgba(255,100,100,0.2);
}
@media (max-width: 720px) {
  .admin-table th:nth-child(4),
  .admin-table td:nth-child(4) { display: none; }
  .recovery-list { grid-template-columns: 1fr; }
}

/* ---------- Field hint ---------- */
.field-hint {
  font-weight: 400;
  opacity: 0.65;
  font-size: 0.85em;
}

/* ---------- Security panel ---------- */
.security-panel {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  justify-content: flex-end;
}
.security-panel.hidden { display: none; }
.security-panel-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 16, 0.55);
  backdrop-filter: blur(4px);
}
.security-sheet {
  position: relative;
  width: min(420px, 100%);
  height: 100%;
  overflow: auto;
  padding: 1.25rem 1.35rem 2rem;
  background: rgba(12, 16, 28, 0.96);
  border-left: 1px solid rgba(255,255,255,0.08);
  box-shadow: -24px 0 60px rgba(0,0,0,0.35);
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}
.security-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}
.security-header h2 {
  margin: 0.2rem 0 0;
  font-size: 1.25rem;
  font-weight: 650;
}
.security-section h3 {
  margin: 0 0 0.35rem;
  font-size: 0.98rem;
  font-weight: 600;
}
.security-desc {
  margin: 0 0 0.85rem;
  color: var(--muted, #8b95a8);
  font-size: 0.86rem;
  line-height: 1.45;
}
.security-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.device-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.device-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
}
.device-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.device-meta strong {
  font-size: 0.9rem;
  font-weight: 600;
}
.device-meta small {
  color: var(--muted, #8b95a8);
  font-size: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
}
.device-revoke {
  flex-shrink: 0;
  border: 1px solid rgba(255,120,120,0.3);
  background: rgba(255,80,80,0.08);
  color: #ff9b9b;
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}
.device-revoke:hover { background: rgba(255,80,80,0.16); }
.device-revoke:disabled { opacity: 0.5; cursor: default; }
.security-empty {
  color: var(--muted, #8b95a8);
  font-size: 0.88rem;
  padding: 0.5rem 0;
}

/* ---------- Admin invites ---------- */
.invite-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1rem 0.25rem;
}
.invite-hint {
  margin: 0;
  flex: 1;
  min-width: 200px;
  color: var(--muted, #8b95a8);
  font-size: 0.88rem;
  line-height: 1.45;
}
.invite-fresh {
  margin: 0.5rem 1rem 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: rgba(72, 210, 150, 0.1);
  border: 1px solid rgba(72, 210, 150, 0.25);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.9rem;
}
.invite-fresh code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.06em;
  font-size: 1rem;
  color: #7dffc0;
}
.invite-code-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.04em;
  margin-right: 0.4rem;
}
button.linkish {
  border: none;
  background: none;
  color: #8b9cff;
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0;
}
button.linkish:hover { color: #c5cbff; }

@media (max-width: 720px) {
  .security-sheet { width: 100%; }
  .device-meta small { max-width: 180px; }
}

/* ---------- Admin auth gate ---------- */
.admin-auth-card {
  max-width: 440px;
  margin: 0 auto 1.5rem;
  padding: 1.35rem 1.4rem 1.5rem;
  border-radius: var(--radius-lg, 22px);
  background: rgba(16, 20, 32, 0.85);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: var(--shadow-md, 0 18px 44px rgba(0,0,0,0.25));
}
.admin-auth-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
}
.admin-auth-panel .login-button { margin-top: 0.35rem; }
.admin-auth-card code {
  font-size: 0.82em;
  word-break: break-all;
}
