:root {
  color-scheme: dark;
  --bg: #09101a;
  --surface: #0d1623;
  --surface-2: #111d2c;
  --surface-3: #162437;
  --surface-hover: #17283d;
  --line: rgba(156, 180, 210, 0.12);
  --line-strong: rgba(156, 180, 210, 0.2);
  --text: #eef5ff;
  --text-soft: #9eb0c7;
  --text-faint: #6f839c;
  --accent: #4ca7ff;
  --accent-strong: #2e8fff;
  --accent-soft: rgba(76, 167, 255, 0.14);
  --accent-glow: rgba(60, 151, 255, 0.3);
  --message-in: #182639;
  --message-out: #2576d9;
  --message-out-text: #fff;
  --chat-background-base: #071423;
  --chat-glow-one: rgba(38, 184, 255, 0.22);
  --chat-glow-two: rgba(126, 73, 255, 0.2);
  --chat-pattern: rgba(194, 225, 255, 0.1);
  --chat-custom-color: #14213d;
  --danger: #ff6b7d;
  --success: #49d398;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  --radius-sm: 10px;
  --radius-md: 15px;
  --radius-lg: 22px;
  --rail-width: 78px;
  --sidebar-width: 354px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #edf3f9;
  --surface: #ffffff;
  --surface-2: #f5f8fc;
  --surface-3: #eaf1f8;
  --surface-hover: #edf4fb;
  --line: rgba(48, 72, 100, 0.12);
  --line-strong: rgba(48, 72, 100, 0.2);
  --text: #172335;
  --text-soft: #667b94;
  --text-faint: #8a9aab;
  --accent: #278be9;
  --accent-strong: #147bdc;
  --accent-soft: rgba(39, 139, 233, 0.12);
  --accent-glow: rgba(39, 139, 233, 0.2);
  --message-in: #ffffff;
  --message-out: #2f8ee5;
  --message-out-text: #ffffff;
  --shadow: 0 22px 60px rgba(43, 73, 105, 0.16);
}

:root[data-chat-background="cosmos"] {
  --chat-background-base: #090a1b;
  --chat-glow-one: rgba(100, 76, 255, 0.28);
  --chat-glow-two: rgba(218, 67, 255, 0.15);
  --chat-pattern: rgba(194, 199, 255, 0.13);
}

:root[data-chat-background="sunset"] {
  --chat-background-base: #24111c;
  --chat-glow-one: rgba(255, 112, 84, 0.28);
  --chat-glow-two: rgba(255, 189, 84, 0.16);
  --chat-pattern: rgba(255, 226, 206, 0.11);
}

:root[data-chat-background="forest"] {
  --chat-background-base: #071a18;
  --chat-glow-one: rgba(42, 204, 156, 0.22);
  --chat-glow-two: rgba(80, 144, 255, 0.13);
  --chat-pattern: rgba(197, 255, 233, 0.1);
}

:root[data-chat-background="minimal"] {
  --chat-background-base: var(--bg);
  --chat-glow-one: transparent;
  --chat-glow-two: transparent;
  --chat-pattern: color-mix(in srgb, var(--text) 7%, transparent);
}

:root[data-chat-background="custom"] {
  --chat-background-base: var(--chat-custom-color);
  --chat-glow-one: color-mix(in srgb, var(--chat-custom-color) 62%, #37b8ff 38%);
  --chat-glow-two: color-mix(in srgb, var(--chat-custom-color) 72%, #9b55ff 28%);
  --chat-pattern: rgba(255, 255, 255, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

svg {
  display: block;
}

.toast-region {
  position: fixed;
  z-index: 100;
  top: 18px;
  left: 50%;
  display: grid;
  gap: 8px;
  width: min(400px, calc(100% - 32px));
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 14px;
  animation: toast-in 180ms ease-out;
  backdrop-filter: blur(16px);
}

.toast::before {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

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

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
}

/* Authentication */

.auth-view {
  position: relative;
  display: grid;
  min-height: 100%;
  place-items: center;
  overflow: auto;
  padding: 32px;
  background:
    radial-gradient(circle at 18% 12%, rgba(64, 150, 255, 0.2), transparent 34%),
    radial-gradient(circle at 90% 86%, rgba(72, 214, 191, 0.11), transparent 30%),
    var(--bg);
}

.auth-view::before {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 42px 42px;
  content: "";
  pointer-events: none;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
}

.auth-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(390px, 1fr);
  width: min(940px, 100%);
  min-height: 590px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-art {
  position: relative;
  display: grid;
  place-content: center;
  overflow: hidden;
  padding: 52px;
  background: linear-gradient(145deg, #0b6fcc 0%, #174981 50%, #0e243c 100%);
  isolation: isolate;
}

.auth-art::before {
  position: absolute;
  inset: -20%;
  z-index: -2;
  background: conic-gradient(from 210deg, transparent, rgba(87, 210, 255, 0.2), transparent 34%);
  content: "";
  animation: slow-spin 18s linear infinite;
}

.auth-art::after {
  position: absolute;
  right: -70px;
  bottom: -100px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: rgba(72, 226, 200, 0.12);
  filter: blur(4px);
  content: "";
}

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

.auth-orbit {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
}

.auth-orbit-one {
  width: 330px;
  height: 330px;
}

.auth-orbit-two {
  width: 460px;
  height: 460px;
  border-style: dashed;
  opacity: 0.55;
}

.auth-mark {
  position: relative;
  display: grid;
  width: 120px;
  height: 120px;
  margin: 0 auto 28px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 34px;
  background: rgba(255, 255, 255, 0.13);
  box-shadow: 0 24px 60px rgba(0, 18, 48, 0.3), inset 0 1px rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
}

.auth-mark img {
  width: 92px;
  height: 92px;
  border-radius: 26px;
  object-fit: cover;
}

.auth-mark .mark-bolt,
.brand-icon .mark-bolt,
.brand-mark .mark-bolt,
.welcome-graphic .mark-bolt {
  fill: currentColor;
  stroke: none;
}

.auth-art p {
  position: relative;
  margin: 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 19px;
  font-weight: 540;
  letter-spacing: -0.01em;
  text-align: center;
}

.auth-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 54px 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  font-weight: 730;
  letter-spacing: -0.02em;
}

.auth-brand {
  margin-bottom: 42px;
}

.brand-icon {
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(145deg, #55baff, #357cff);
  color: #fff;
}

.brand-icon.small {
  width: 34px;
  height: 34px;
}

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

.auth-heading h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 3vw, 36px);
  line-height: 1.12;
  letter-spacing: -0.04em;
}

.auth-heading p {
  margin: 0;
  color: var(--text-soft);
  font-size: 15px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 34px 0 26px;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface-2);
}

.auth-tab {
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  transition: 160ms ease;
}

.auth-tab.active {
  background: var(--surface-3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  color: var(--text);
}

.auth-form,
.field {
  display: grid;
}

.auth-form {
  gap: 17px;
}

.field {
  gap: 7px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 650;
}

.input-wrap {
  display: flex;
  min-height: 49px;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-2);
  transition: 150ms ease;
}

.input-wrap:focus-within {
  border-color: color-mix(in srgb, var(--accent) 65%, transparent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input-wrap svg {
  width: 19px;
  fill: none;
  stroke: var(--text-faint);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.at-sign {
  color: var(--text-faint);
  font-size: 18px;
  font-weight: 600;
}

.input-wrap input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
}

.input-wrap input::placeholder {
  color: var(--text-faint);
}

.input-action {
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.form-error {
  min-height: 0;
  margin: -4px 0;
  color: var(--danger);
  font-size: 13px;
}

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

.primary-button,
.secondary-button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 150ms ease, filter 150ms ease, background 150ms ease;
}

.primary-button {
  margin-top: 4px;
  border: 0;
  background: linear-gradient(135deg, #44aaff, #327cf1);
  box-shadow: 0 10px 25px rgba(44, 132, 240, 0.24);
  color: #fff;
}

.primary-button svg {
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.primary-button:hover,
.secondary-button:hover {
  filter: brightness(1.07);
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: wait;
  filter: saturate(0.6);
  opacity: 0.7;
}

/* Application shell */

.app-view {
  position: relative;
  display: grid;
  width: 100%;
  height: 100dvh;
  grid-template-columns: var(--rail-width) var(--sidebar-width) minmax(0, 1fr);
  background: var(--bg);
}

.nav-rail {
  position: relative;
  z-index: 15;
  display: flex;
  min-height: 0;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 20px 10px 14px;
  border-right: 1px solid var(--line);
  background: #0a1320;
}

:root[data-theme="light"] .nav-rail {
  background: #e8f0f8;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(145deg, #52b8ff, #3279f2);
  box-shadow: 0 10px 25px rgba(45, 126, 238, 0.26);
  color: #fff;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.rail-actions,
.rail-bottom {
  display: grid;
  width: 100%;
  gap: 8px;
}

.rail-actions {
  margin-top: 22px;
  align-content: start;
  flex: 1;
}

.rail-button {
  position: relative;
  display: grid;
  width: 58px;
  min-height: 57px;
  margin: 0 auto;
  padding: 7px 4px;
  place-items: center;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  transition: 150ms ease;
}

.rail-button svg {
  width: 23px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.rail-button span {
  font-size: 12px;
  font-weight: 600;
}

.rail-button:hover,
.rail-button.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.theme-sun {
  display: none;
}

:root[data-theme="light"] .theme-sun {
  display: block;
}

:root[data-theme="light"] .theme-moon {
  display: none;
}

.profile-button {
  display: grid;
  width: 50px;
  height: 50px;
  margin: 6px auto 0;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

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

.mobile-profile-button {
  display: none;
  width: 40px;
  height: 40px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.mobile-profile-button .avatar {
  width: 36px;
  height: 36px;
  font-size: 13px;
}

.profile-menu {
  position: absolute;
  z-index: 30;
  bottom: 16px;
  left: 69px;
  width: 248px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: menu-in 140ms ease-out;
}

@keyframes menu-in {
  from { opacity: 0; transform: translate(-6px, 5px) scale(0.97); }
}

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

.profile-menu-head div {
  min-width: 0;
}

.profile-menu-head strong,
.profile-menu-head span:not(.avatar) {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-menu-head strong {
  font-size: 14px;
}

.profile-menu-head span:not(.avatar) {
  color: var(--text-soft);
  font-size: 13px;
}

.menu-item {
  display: flex;
  width: calc(100% - 12px);
  min-height: 42px;
  align-items: center;
  gap: 10px;
  margin: 6px;
  padding: 0 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  font-size: 14px;
  cursor: pointer;
}

.menu-item:hover {
  background: var(--surface-hover);
}

.menu-item.danger {
  color: var(--danger);
}

.menu-item svg {
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.chat-sidebar {
  position: relative;
  z-index: 10;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.sidebar-header {
  padding: 24px 18px 15px;
}

.sidebar-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin: 0 2px 20px;
}

.eyebrow {
  display: block;
  margin-bottom: 2px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.sidebar-title-row h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1.12;
  letter-spacing: -0.035em;
}

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.icon-button:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.icon-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.icon-button:disabled:hover {
  background: transparent;
  color: var(--text-soft);
}

.icon-button.accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.icon-button.accent:hover {
  background: var(--accent);
  color: #fff;
}

.icon-button.small {
  width: 34px;
  height: 34px;
}

.icon-button svg {
  width: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.search-box {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text-faint);
  transition: 150ms ease;
}

.search-box:focus-within {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-box svg {
  width: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

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

.search-box input::placeholder {
  color: var(--text-faint);
}

.search-box kbd {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text-faint);
  font-family: inherit;
  font-size: 11px;
}

.search-hint {
  padding: 10px 21px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--text-soft);
  font-size: 13px;
}

.chat-list {
  min-height: 0;
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 3px 9px 12px;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

.list-section-label {
  margin: 12px 11px 6px;
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.chat-item,
.user-result {
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns: 50px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 10px 11px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 120ms ease;
}

.chat-item:hover,
.user-result:hover {
  background: var(--surface-hover);
}

.chat-item.active {
  background: linear-gradient(90deg, var(--accent-soft), color-mix(in srgb, var(--accent-soft) 35%, transparent));
}

.chat-item.active::before {
  position: absolute;
  left: 0;
  width: 3px;
  height: 34px;
  border-radius: 0 4px 4px 0;
  background: var(--accent);
  content: "";
}

.chat-item {
  position: relative;
}

.avatar {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 50%;
  background: var(--avatar, linear-gradient(145deg, #3f9cff, #5d64e8));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.16);
  color: #fff;
  font-weight: 750;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-sm { width: 40px; height: 40px; font-size: 14px; }
.avatar-md { width: 46px; height: 46px; font-size: 16px; }
.avatar-lg { width: 50px; height: 50px; font-size: 17px; }
.avatar-xl { width: 88px; height: 88px; font-size: 29px; }

.avatar.saved-avatar {
  background: linear-gradient(145deg, #38b8bd, #347ae2);
}

.avatar.saved-avatar svg {
  width: 23px;
  fill: none;
  stroke: #fff;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.chat-copy,
.result-copy {
  min-width: 0;
}

.chat-copy-head {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.chat-copy strong,
.result-copy strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 690;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-time {
  flex: 0 0 auto;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 520;
}

.chat-preview,
.result-copy span {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: var(--text-soft);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-preview .own-prefix {
  color: var(--accent);
}

.chat-meta {
  display: grid;
  min-width: 18px;
  justify-items: end;
  gap: 7px;
}

.unread-badge {
  display: grid;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  place-items: center;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 750;
}

.online-dot {
  width: 9px;
  height: 9px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 2px var(--success);
}

.avatar-wrap {
  position: relative;
  width: 50px;
  height: 50px;
}

.avatar-wrap .online-indicator {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 12px;
  height: 12px;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--success);
}

.search-empty,
.chat-list-empty {
  display: grid;
  min-height: 210px;
  padding: 28px;
  place-content: center;
  color: var(--text-soft);
  text-align: center;
}

.search-empty strong,
.chat-list-empty strong {
  margin-bottom: 5px;
  color: var(--text);
  font-size: 15px;
}

.search-empty span,
.chat-list-empty span {
  max-width: 240px;
  font-size: 13px;
}

.sidebar-footer {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-top: 1px solid var(--line);
  color: var(--text-faint);
  font-size: 12px;
}

.connection-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f2a65a;
}

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

.conversation {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 78% 4%, var(--chat-glow-one), transparent 42%),
    radial-gradient(circle at 8% 92%, var(--chat-glow-two), transparent 38%),
    linear-gradient(145deg, color-mix(in srgb, var(--chat-background-base) 88%, #000 12%), var(--chat-background-base));
  isolation: isolate;
}

.conversation::before {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at center, var(--chat-pattern) 1px, transparent 1.3px),
    linear-gradient(125deg, transparent 46%, color-mix(in srgb, var(--chat-pattern) 42%, transparent) 47%, transparent 48%);
  background-size: 28px 28px, 86px 86px;
  content: "";
  opacity: 0.34;
  pointer-events: none;
}

.conversation::after {
  position: absolute;
  z-index: 0;
  top: -45%;
  right: -22%;
  width: 66%;
  height: 120%;
  border-radius: 50%;
  background: conic-gradient(from 30deg, transparent, var(--chat-glow-one), transparent 45%, var(--chat-glow-two), transparent);
  content: "";
  filter: blur(80px);
  opacity: 0.28;
  pointer-events: none;
  animation: chat-ambient 16s ease-in-out infinite alternate;
}

@keyframes chat-ambient {
  to { transform: translate(-12%, 18%) rotate(16deg) scale(1.12); }
}

.welcome-state {
  position: relative;
  z-index: 1;
  display: grid;
  height: 100%;
  padding: 32px;
  place-content: center;
  justify-items: center;
  text-align: center;
}

.welcome-graphic {
  position: relative;
  display: grid;
  width: 150px;
  height: 150px;
  margin-bottom: 26px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 48px;
  background: linear-gradient(145deg, var(--surface-3), var(--surface));
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.16);
  transform: rotate(-3deg);
}

.welcome-graphic svg {
  width: 86px;
  fill: var(--accent);
  color: #fff;
}

.welcome-bubble {
  position: absolute;
  border-radius: 14px;
  background: var(--surface-3);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.15);
}

.welcome-bubble.one {
  top: -19px;
  right: -31px;
  width: 54px;
  height: 34px;
  transform: rotate(10deg);
}

.welcome-bubble.two {
  bottom: 3px;
  left: -39px;
  width: 67px;
  height: 40px;
  transform: rotate(-8deg);
}

.welcome-state h2 {
  margin: 0 0 8px;
  font-size: 25px;
  letter-spacing: -0.03em;
}

.welcome-state p {
  margin: 0 0 24px;
  color: var(--text-soft);
  font-size: 14px;
}

.secondary-button {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
}

.chat-view {
  position: relative;
  z-index: 2;
  display: grid;
  height: 100%;
  min-height: 0;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.conversation-header {
  display: flex;
  min-height: 72px;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(18px);
}

.chat-identity {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.identity-copy {
  display: block;
  min-width: 0;
}

.identity-copy strong,
.identity-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity-copy strong {
  font-size: 15px;
  font-weight: 710;
}

.identity-copy span {
  margin-top: 2px;
  color: var(--text-soft);
  font-size: 12px;
}

.identity-copy span.online {
  color: var(--success);
}

.conversation-actions {
  display: flex;
  align-items: center;
  gap: 3px;
}

.mobile-back {
  display: none;
}

.message-search-bar {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 10px;
  padding: 6px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.message-search-bar > svg {
  width: 19px;
  fill: none;
  stroke: var(--text-faint);
  stroke-linecap: round;
  stroke-width: 1.8;
}

.message-search-bar input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
}

.message-search-bar span {
  color: var(--text-faint);
  font-size: 12px;
}

.message-area {
  position: relative;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

.message-list {
  display: flex;
  width: min(820px, calc(100% - 40px));
  min-height: 100%;
  flex-direction: column;
  justify-content: flex-end;
  margin: 0 auto;
  padding: 26px 0 16px;
}

.load-older {
  display: block;
  min-height: 34px;
  margin: 14px auto -8px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  color: var(--text-soft);
  font-size: 12px;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.day-separator {
  align-self: center;
  margin: 15px 0;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 650;
  backdrop-filter: blur(10px);
}

.message-row {
  display: flex;
  width: 100%;
  margin-top: 5px;
  justify-content: flex-start;
}

.message-row.outgoing {
  justify-content: flex-end;
}

.message-bubble {
  position: relative;
  max-width: min(72%, 590px);
  padding: 9px 12px 7px;
  border: 1px solid var(--line);
  border-radius: 5px 16px 16px 16px;
  background: var(--message-in);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.message-row.outgoing .message-bubble {
  border-color: transparent;
  border-radius: 16px 5px 16px 16px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--message-out) 92%, white), var(--message-out));
  color: var(--message-out-text);
}

.message-body {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.42;
}

.message-meta {
  display: flex;
  float: right;
  align-items: center;
  gap: 3px;
  margin: 7px 0 -2px 10px;
  color: var(--text-faint);
  font-size: 10px;
  line-height: 1;
}

.message-row.outgoing .message-meta {
  color: rgba(255, 255, 255, 0.72);
}

.message-checks {
  display: inline-flex;
  width: 16px;
  align-items: center;
}

.message-checks svg {
  width: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.message-bubble.search-match {
  box-shadow: 0 0 0 3px rgba(255, 190, 66, 0.45), 0 5px 20px rgba(0, 0, 0, 0.12);
}

.empty-chat-state {
  position: absolute;
  inset: 0;
  display: grid;
  padding: 24px;
  place-content: center;
  justify-items: center;
  pointer-events: none;
  text-align: center;
}

.empty-chat-icon {
  display: grid;
  width: 64px;
  height: 64px;
  margin-bottom: 14px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--accent);
}

.empty-chat-icon svg {
  width: 34px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.empty-chat-state h3 {
  margin: 0 0 5px;
  font-size: 18px;
}

.empty-chat-state p {
  max-width: 300px;
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
}

.scroll-down {
  position: sticky;
  z-index: 3;
  right: 20px;
  bottom: 13px;
  float: right;
  display: grid;
  width: 42px;
  height: 42px;
  margin-right: 18px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.2);
  color: var(--text-soft);
  cursor: pointer;
}

.scroll-down svg {
  width: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.scroll-unread {
  position: absolute;
  top: -6px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 750;
}

.composer-wrap {
  position: relative;
  padding: 11px 18px max(11px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(18px);
}

.message-form {
  display: flex;
  width: min(850px, 100%);
  min-height: 48px;
  align-items: flex-end;
  gap: 7px;
  margin: 0 auto;
  padding: 5px 6px 5px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 17px;
  background: var(--surface-2);
  transition: 150ms ease;
}

.message-form:focus-within {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.message-form textarea {
  min-width: 0;
  max-height: 144px;
  flex: 1;
  align-self: center;
  resize: none;
  overflow-y: auto;
  padding: 8px 4px 7px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

.message-form textarea::placeholder {
  color: var(--text-faint);
}

.composer-button,
.send-button {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}

.composer-button {
  background: transparent;
  color: var(--text-faint);
}

.composer-button:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.send-button {
  background: var(--accent);
  color: #fff;
  transition: transform 140ms ease, opacity 140ms ease;
}

.send-button:not(:disabled):hover {
  transform: scale(1.04);
}

.send-button:disabled {
  background: var(--surface-3);
  color: var(--text-faint);
  cursor: default;
  opacity: 0.7;
}

.composer-button svg,
.send-button svg {
  width: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.emoji-panel {
  position: absolute;
  z-index: 8;
  bottom: calc(100% + 4px);
  left: max(18px, calc(50% - 425px));
  display: grid;
  width: 270px;
  grid-template-columns: repeat(6, 1fr);
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: menu-in 140ms ease-out;
}

.emoji-panel button {
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  font-size: 22px;
  cursor: pointer;
}

.emoji-panel button:hover {
  background: var(--surface-hover);
}

.info-panel {
  position: absolute;
  z-index: 25;
  top: 0;
  right: 0;
  width: min(340px, calc(100% - 40px));
  height: 100%;
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.22);
  transform: translateX(102%);
  transition: transform 220ms ease;
}

.info-panel.open {
  transform: translateX(0);
}

.info-panel > header {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 0 20px;
  border-bottom: 1px solid var(--line);
}

.info-panel h2 {
  margin: 0;
  font-size: 17px;
}

.info-profile {
  display: grid;
  justify-items: center;
  padding: 30px 22px 24px;
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.info-profile h3 {
  margin: 14px 0 2px;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.info-profile p {
  margin: 0 0 12px;
  color: var(--text-soft);
  font-size: 14px;
}

.presence-pill {
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 12px;
}

.presence-pill.online {
  background: rgba(73, 211, 152, 0.12);
  color: var(--success);
}

.info-block {
  padding: 20px;
}

.info-label {
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.info-block p {
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 14px;
}

/* Profile and appearance */

.modal-scrim {
  position: absolute;
  z-index: 70;
  inset: 0;
  border: 0;
  background: rgba(2, 7, 14, 0.68);
  backdrop-filter: blur(7px);
}

.profile-modal {
  position: absolute;
  z-index: 71;
  top: 50%;
  left: 50%;
  width: min(720px, calc(100% - 32px));
  max-height: min(860px, calc(100% - 32px));
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: 0 34px 110px rgba(0, 0, 0, 0.48);
  transform: translate(-50%, -50%);
  animation: profile-modal-in 180ms ease-out;
  backdrop-filter: blur(28px);
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

@keyframes profile-modal-in {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 14px)) scale(0.98); }
}

.profile-modal-header {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 20px 14px 24px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 91%, transparent);
  backdrop-filter: blur(24px);
}

.profile-modal-header h2,
.background-settings h3 {
  margin: 0;
  letter-spacing: -0.025em;
}

.profile-modal-header h2 {
  margin-top: 2px;
  font-size: 21px;
}

.profile-form {
  display: grid;
  gap: 22px;
  padding: 22px 24px 24px;
}

.profile-avatar-editor {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    radial-gradient(circle at 10% 20%, var(--accent-soft), transparent 45%),
    var(--surface-2);
}

.profile-avatar-preview {
  width: 92px;
  height: 92px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22), 0 0 0 5px var(--accent-soft);
  font-size: 29px;
}

.profile-avatar-editor strong {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
}

.profile-avatar-editor p,
.background-settings > div:first-child p {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
}

.profile-avatar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.secondary-button.compact {
  min-height: 34px;
  padding: 0 13px;
  border-radius: 10px;
  font-size: 13px;
}

.text-button {
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.text-button:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.text-button.danger {
  color: var(--danger);
}

.profile-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.profile-bio-field {
  grid-column: 1 / -1;
}

.profile-bio-field > span:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.profile-bio-field small {
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 600;
}

.input-wrap.plain {
  min-height: 45px;
  background: var(--surface-2);
}

.input-wrap textarea {
  width: 100%;
  resize: vertical;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  line-height: 1.45;
}

.input-wrap.textarea-wrap {
  min-height: 86px;
  align-items: flex-start;
  padding-block: 11px;
}

.background-settings {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-2);
}

.background-settings h3 {
  margin-bottom: 3px;
  font-size: 16px;
}

.background-presets {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
}

.background-preset {
  display: grid;
  gap: 7px;
  padding: 6px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
  transition: 150ms ease;
}

.background-preset > span {
  display: block;
  height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9px;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.12);
}

.background-preset.aurora > span { background: radial-gradient(circle at 70% 15%, #20bdf0, transparent 42%), radial-gradient(circle at 10% 90%, #7a49e9, transparent 44%), #071423; }
.background-preset.cosmos > span { background: radial-gradient(circle at 30% 20%, #684cff, transparent 38%), radial-gradient(circle at 90% 85%, #ce43ff, transparent 38%), #090a1b; }
.background-preset.sunset > span { background: radial-gradient(circle at 75% 12%, #ff7154, transparent 43%), radial-gradient(circle at 12% 90%, #ffbd54, transparent 42%), #24111c; }
.background-preset.forest > span { background: radial-gradient(circle at 72% 14%, #2acc9c, transparent 42%), radial-gradient(circle at 7% 92%, #3478a5, transparent 42%), #071a18; }
.background-preset.minimal > span { background: var(--bg); }

.background-preset:hover,
.background-preset.active {
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  background: var(--accent-soft);
  color: var(--text);
  transform: translateY(-1px);
}

.background-color-field {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 10px 8px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 650;
}

.background-color-field input {
  width: 58px;
  height: 28px;
  padding: 2px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

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

.profile-form-actions .secondary-button,
.profile-save-button {
  min-width: 126px;
}

.profile-save-button {
  margin-top: 0;
}

/* Calls */

.call-button.hidden {
  display: none;
}

.incoming-call {
  position: absolute;
  z-index: 90;
  top: 18px;
  right: 18px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  width: min(430px, calc(100% - 36px));
  padding: 13px;
  border: 1px solid var(--line-strong);
  border-radius: 19px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  animation: incoming-call-in 180ms ease-out;
  backdrop-filter: blur(20px);
}

@keyframes incoming-call-in {
  from { opacity: 0; transform: translateY(-10px) scale(0.98); }
}

.incoming-call-avatar {
  width: 52px;
  height: 52px;
  font-size: 17px;
  box-shadow: 0 0 0 5px var(--accent-soft), inset 0 1px rgba(255, 255, 255, 0.16);
}

.incoming-call-copy {
  min-width: 0;
}

.incoming-call-copy span,
.incoming-call-copy strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.incoming-call-copy span {
  margin-bottom: 3px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 720;
}

.incoming-call-copy strong {
  font-size: 16px;
}

.incoming-call-actions {
  display: flex;
  gap: 9px;
}

.round-call-button,
.call-control {
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  transition: filter 140ms ease, transform 140ms ease, background 140ms ease;
}

.round-call-button:hover,
.call-control:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.round-call-button {
  width: 46px;
  height: 46px;
}

.round-call-button.accept {
  background: #30bd79;
}

.round-call-button.danger,
.call-control.end {
  background: #eb4d62;
}

.round-call-button svg,
.call-control svg {
  width: 23px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.round-call-button.danger svg,
.call-control.end svg {
  transform: rotate(135deg);
}

.call-overlay {
  position: absolute;
  z-index: 80;
  inset: 0;
  overflow: hidden;
  background: #07101c;
  color: #fff;
}

.remote-video {
  position: absolute;
  width: 100%;
  height: 100%;
  inset: 0;
  object-fit: cover;
  opacity: 0;
  transition: opacity 220ms ease;
}

.call-overlay.video-mode.remote-ready .remote-video {
  opacity: 1;
}

.call-backdrop {
  position: absolute;
  display: grid;
  inset: 0;
  align-content: center;
  justify-items: center;
  padding: 38px 24px 132px;
  background:
    radial-gradient(circle at 50% 35%, rgba(54, 145, 231, 0.28), transparent 31%),
    radial-gradient(circle at 12% 94%, rgba(53, 210, 173, 0.13), transparent 28%),
    linear-gradient(145deg, #091728, #060b13);
  text-align: center;
}

.call-overlay.video-mode.remote-ready .call-backdrop {
  justify-content: start;
  align-content: start;
  justify-items: start;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.52), transparent 32%, transparent 70%, rgba(0, 0, 0, 0.58));
  text-align: left;
}

.call-overlay.video-mode.remote-ready .call-avatar {
  display: none;
}

.call-avatar {
  width: 128px;
  height: 128px;
  margin-bottom: 22px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28), 0 0 0 10px rgba(255, 255, 255, 0.04);
  font-size: 39px;
}

.call-backdrop h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: -0.035em;
}

.call-backdrop p {
  margin: 7px 0 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
}

.local-video {
  position: absolute;
  z-index: 2;
  top: 22px;
  right: 22px;
  width: min(230px, 24vw);
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 17px;
  background: #111b28;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.35);
  transform: scaleX(-1);
}

.call-controls {
  position: absolute;
  z-index: 3;
  bottom: 34px;
  left: 50%;
  display: flex;
  gap: 14px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 38px;
  background: rgba(5, 11, 19, 0.62);
  transform: translateX(-50%);
  backdrop-filter: blur(18px);
}

.call-control {
  width: 58px;
  height: 58px;
  background: rgba(255, 255, 255, 0.14);
}

.call-control.off {
  background: rgba(255, 255, 255, 0.92);
  color: #162131;
}

.call-control .disabled-icon,
.call-control.off .enabled-icon {
  display: none;
}

.call-control.off .disabled-icon {
  display: block;
}

.call-control.end {
  width: 66px;
}

.panel-scrim {
  position: absolute;
  z-index: 24;
  inset: 0;
  border: 0;
  background: rgba(2, 7, 14, 0.45);
  cursor: default;
}

@media (max-width: 1050px) {
  :root {
    --sidebar-width: 320px;
  }

  .message-bubble {
    max-width: 80%;
  }
}

@media (max-width: 820px) {
  :root {
    --rail-width: 68px;
    --sidebar-width: 300px;
  }

  .nav-rail {
    padding-inline: 5px;
  }

  .rail-button {
    width: 55px;
  }

  .search-box kbd {
    display: none;
  }

  .auth-shell {
    grid-template-columns: 1fr;
    width: min(480px, 100%);
  }

  .auth-art {
    display: none;
  }
}

@media (max-width: 680px) {
  .app-view {
    display: block;
  }

  .nav-rail {
    display: none;
  }

  .mobile-profile-button {
    display: grid;
  }

  .chat-sidebar,
  .conversation {
    position: absolute;
    inset: 0;
    width: 100%;
    border: 0;
  }

  .chat-sidebar {
    z-index: 4;
  }

  .conversation {
    z-index: 5;
    transform: translateX(102%);
    transition: transform 210ms ease;
  }

  .app-view.mobile-chat-open .conversation {
    transform: translateX(0);
  }

  .sidebar-header {
    padding-top: max(20px, env(safe-area-inset-top));
  }

  .sidebar-footer {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .mobile-back {
    display: grid;
  }

  .conversation-header {
    min-height: 66px;
    padding-top: max(8px, env(safe-area-inset-top));
    padding-inline: 8px 10px;
  }

  #headerSearchButton {
    display: none;
  }

  .identity-copy strong {
    font-size: 14px;
  }

  .message-list {
    width: calc(100% - 20px);
    padding-top: 18px;
  }

  .message-bubble {
    max-width: 86%;
  }

  .composer-wrap {
    padding-inline: 9px;
  }

  .emoji-panel {
    left: 10px;
  }

  .profile-menu {
    position: fixed;
    right: 12px;
    top: max(72px, calc(env(safe-area-inset-top) + 62px));
    bottom: auto;
    left: auto;
  }

  .profile-modal {
    width: calc(100% - 20px);
    max-height: calc(100% - 20px);
    border-radius: 20px;
  }

  .profile-modal-header {
    padding-inline: 18px 13px;
  }

  .profile-form {
    padding: 18px;
  }

  .background-presets {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .incoming-call {
    top: 10px;
    right: 10px;
    width: calc(100% - 20px);
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .incoming-call-avatar {
    width: 46px;
    height: 46px;
  }

  .round-call-button {
    width: 43px;
    height: 43px;
  }

  .local-video {
    top: 14px;
    right: 14px;
    width: 34vw;
  }

  .call-controls {
    bottom: max(22px, env(safe-area-inset-bottom));
  }

  .call-control {
    width: 54px;
    height: 54px;
  }
}

@media (max-width: 520px) {
  .auth-view {
    padding: 0;
    background: var(--surface);
  }

  .auth-shell {
    min-height: 100%;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .auth-card {
    justify-content: flex-start;
    padding: max(42px, env(safe-area-inset-top)) 24px 30px;
  }

  .auth-brand {
    margin-bottom: 58px;
  }

  .sidebar-title-row h1 {
    font-size: 24px;
  }

  .chat-item,
  .user-result {
    padding-block: 9px;
  }

  .welcome-state br {
    display: none;
  }

  .profile-fields {
    grid-template-columns: 1fr;
  }

  .profile-bio-field {
    grid-column: auto;
  }

  .profile-avatar-editor {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .profile-avatar-actions {
    justify-content: center;
  }

  .background-presets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-form-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

/* Show Chat 6.0 — visual refresh */

:root {
  --bg: #070912;
  --surface: #0d1220;
  --surface-2: #121a2b;
  --surface-3: #19243a;
  --surface-hover: #18243a;
  --line: rgba(157, 177, 222, 0.11);
  --line-strong: rgba(157, 177, 222, 0.2);
  --text: #f4f7ff;
  --text-soft: #a5b1cc;
  --text-faint: #6f7e9d;
  --accent: #55d9ff;
  --accent-strong: #5585ff;
  --accent-soft: rgba(76, 197, 255, 0.12);
  --accent-glow: rgba(84, 186, 255, 0.3);
  --message-in: rgba(23, 32, 52, 0.96);
  --message-out: #526df4;
  --chat-background-base: #090d19;
  --chat-glow-one: rgba(25, 190, 255, 0.2);
  --chat-glow-two: rgba(139, 72, 255, 0.18);
  --rail-width: 86px;
  --sidebar-width: 386px;
}

body {
  background:
    radial-gradient(circle at 12% -10%, rgba(65, 136, 255, 0.14), transparent 32%),
    var(--bg);
}

.app-view {
  background: var(--bg);
}

.nav-rail {
  padding: 18px 11px 15px;
  border-right-color: rgba(143, 168, 219, 0.1);
  background:
    linear-gradient(180deg, rgba(16, 22, 38, 0.98), rgba(8, 12, 22, 0.98));
}

.brand-mark {
  width: 52px;
  height: 52px;
  overflow: hidden;
  border: 1px solid rgba(126, 218, 255, 0.35);
  border-radius: 17px;
  background: #0b1331;
  box-shadow: 0 12px 34px rgba(46, 119, 255, 0.28), 0 0 0 5px rgba(71, 188, 255, 0.05);
}

.rail-button {
  width: 64px;
  min-height: 62px;
  border-radius: 17px;
}

.rail-button:hover,
.rail-button.active {
  background: linear-gradient(145deg, rgba(77, 202, 255, 0.16), rgba(108, 91, 255, 0.12));
  box-shadow: inset 0 0 0 1px rgba(99, 202, 255, 0.12);
}

.chat-sidebar {
  border-right-color: rgba(143, 168, 219, 0.11);
  background:
    radial-gradient(circle at 30% 0%, rgba(61, 122, 255, 0.08), transparent 31%),
    rgba(12, 17, 30, 0.98);
}

.sidebar-header {
  padding: 27px 20px 17px;
}

.sidebar-title-row h1 {
  margin-top: 3px;
  font-size: 28px;
  letter-spacing: -0.045em;
}

.eyebrow {
  background: linear-gradient(90deg, #5fe6ff, #8d8cff);
  background-clip: text;
  color: transparent;
}

.search-box {
  min-height: 49px;
  border: 1px solid rgba(151, 178, 226, 0.12);
  border-radius: 15px;
  background: rgba(21, 30, 49, 0.78);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
}

.chat-list {
  padding: 5px 10px 14px;
}

.chat-item,
.user-result {
  min-height: 74px;
  margin: 3px 0;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 18px;
}

.chat-item:hover,
.user-result:hover {
  border-color: rgba(134, 165, 224, 0.1);
  background: rgba(24, 35, 57, 0.72);
}

.chat-item.active {
  border-color: rgba(87, 203, 255, 0.2);
  background:
    linear-gradient(105deg, rgba(58, 165, 255, 0.19), rgba(107, 85, 255, 0.09)),
    rgba(18, 27, 46, 0.94);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14), inset 0 1px rgba(255, 255, 255, 0.035);
}

.chat-item.active::before {
  left: -1px;
  width: 4px;
  height: 42px;
  border-radius: 0 6px 6px 0;
  background: linear-gradient(#50e0ff, #6479ff);
  box-shadow: 0 0 18px rgba(69, 207, 255, 0.5);
}

.avatar {
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.2), 0 8px 22px rgba(0, 0, 0, 0.2);
}

.conversation {
  background:
    radial-gradient(circle at 86% -4%, var(--chat-glow-one), transparent 42%),
    radial-gradient(circle at 0% 102%, var(--chat-glow-two), transparent 42%),
    linear-gradient(145deg, color-mix(in srgb, var(--chat-background-base) 90%, #000 10%), var(--chat-background-base));
}

.conversation::before {
  background-image:
    radial-gradient(circle at center, var(--chat-pattern) 1px, transparent 1.2px),
    linear-gradient(135deg, transparent 47%, color-mix(in srgb, var(--chat-pattern) 30%, transparent) 48%, transparent 49%);
  background-size: 34px 34px, 110px 110px;
  opacity: 0.25;
}

.chat-view {
  position: absolute;
  inset: 0;
  width: 100%;
  height: auto;
  grid-template-rows: 78px auto minmax(0, 1fr) auto;
}

.conversation-header {
  min-height: 78px;
  padding-inline: 22px;
  background: rgba(10, 15, 27, 0.78);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(24px) saturate(135%);
}

.chat-identity {
  gap: 13px;
}

.identity-copy strong {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 16px;
}

.message-list {
  width: min(900px, calc(100% - 42px));
  padding-block: 34px 18px;
}

.message-row {
  margin-top: 7px;
}

.message-bubble {
  padding: 10px 13px 8px;
  border-color: rgba(145, 170, 218, 0.13);
  border-radius: 7px 19px 19px 19px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(14px);
}

.message-row.outgoing .message-bubble {
  border-radius: 19px 7px 19px 19px;
  background: linear-gradient(145deg, #5b7af7, #6755da);
  box-shadow: 0 10px 28px rgba(61, 70, 193, 0.24);
}

.message-author {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0 0 4px;
  color: #73ddff;
  font-size: 11px;
  font-weight: 760;
}

.message-row.outgoing .message-author {
  color: rgba(255, 255, 255, 0.86);
}

.composer-wrap {
  padding: 13px 22px max(15px, env(safe-area-inset-bottom));
  border-top-color: rgba(143, 168, 219, 0.1);
  background: linear-gradient(180deg, rgba(9, 13, 24, 0.73), rgba(9, 13, 24, 0.94));
  backdrop-filter: blur(24px) saturate(135%);
}

.message-form {
  width: min(900px, 100%);
  min-height: 53px;
  padding: 6px 7px 6px 9px;
  border-color: rgba(130, 162, 220, 0.22);
  border-radius: 19px;
  background: rgba(20, 29, 48, 0.88);
  box-shadow: 0 12px 38px rgba(0, 0, 0, 0.18), inset 0 1px rgba(255, 255, 255, 0.035);
}

.message-form:focus-within {
  border-color: rgba(88, 212, 255, 0.48);
  box-shadow: 0 0 0 4px rgba(65, 194, 255, 0.08), 0 12px 38px rgba(0, 0, 0, 0.18);
}

.send-button {
  background: linear-gradient(145deg, #55d9ff, #5b67f4);
  box-shadow: 0 6px 20px rgba(63, 151, 255, 0.28);
}

.welcome-graphic {
  border-color: rgba(97, 205, 255, 0.18);
  background:
    radial-gradient(circle at 25% 20%, rgba(73, 218, 255, 0.18), transparent 45%),
    linear-gradient(145deg, rgba(28, 39, 65, 0.9), rgba(13, 18, 32, 0.92));
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.32), 0 0 50px rgba(64, 133, 255, 0.1);
}

.profile-menu,
.profile-modal,
.accounts-modal,
.info-panel {
  border-color: rgba(149, 176, 225, 0.17);
  background: rgba(12, 17, 30, 0.94);
  backdrop-filter: blur(28px) saturate(135%);
}

.profile-menu {
  width: 276px;
  border-radius: 19px;
}

.profile-menu-head strong,
.chat-copy strong,
.result-copy strong,
.account-copy strong,
.info-profile h3 {
  align-items: center;
  gap: 6px;
}

.verified-name-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.verification-badge {
  position: relative;
  display: inline-grid !important;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  place-items: center;
  clip-path: polygon(50% 0%, 61% 7%, 74% 5%, 82% 16%, 95% 22%, 93% 36%, 100% 50%, 93% 64%, 95% 78%, 82% 84%, 74% 95%, 61% 93%, 50% 100%, 38% 93%, 26% 95%, 18% 84%, 5% 78%, 7% 64%, 0 50%, 7% 36%, 5% 22%, 18% 16%, 26% 5%, 38% 7%);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.32));
  vertical-align: middle;
}

.verification-badge.small {
  width: 17px;
  height: 17px;
  flex-basis: 17px;
}

.verification-badge svg {
  width: 13px !important;
  height: 13px;
  fill: none !important;
  stroke: currentColor !important;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3.2 !important;
}

.verification-badge.small svg {
  width: 11px !important;
  height: 11px;
}

.verification-badge.bronze {
  background: linear-gradient(145deg, #f3a56b, #9a4c23 74%);
  color: #fff8ee;
}

.verification-badge.silver {
  background: linear-gradient(145deg, #eef5ff, #8e9bb2 72%);
  color: #273248;
}

.verification-badge.gold {
  background: linear-gradient(145deg, #fff18a 5%, #ffc532 43%, #be7013 92%);
  color: #1b1303;
  filter: drop-shadow(0 2px 5px rgba(255, 184, 31, 0.38));
}

.code-input-wrap {
  padding-right: 6px;
}

.code-button {
  min-height: 35px;
  flex: 0 0 auto;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.code-button:disabled {
  color: var(--text-faint);
  cursor: default;
}

.field-hint {
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 500;
}

.auth-shell {
  width: min(1020px, 100%);
  min-height: 650px;
  border-color: rgba(124, 172, 241, 0.16);
  background: rgba(12, 17, 30, 0.96);
}

.auth-art {
  background:
    radial-gradient(circle at 25% 18%, rgba(77, 226, 255, 0.28), transparent 29%),
    radial-gradient(circle at 83% 76%, rgba(151, 72, 255, 0.3), transparent 33%),
    linear-gradient(145deg, #0b1733, #11133d 55%, #1a1130);
}

.auth-card {
  max-height: 94vh;
  overflow-y: auto;
  padding: 44px 58px;
}

.auth-mark {
  width: 136px;
  height: 136px;
  border-radius: 38px;
}

.auth-mark img {
  width: 108px;
  height: 108px;
  border-radius: 30px;
}

.profile-modal {
  width: min(780px, calc(100% - 32px));
}

.security-settings,
.info-admin-tools {
  display: grid;
  gap: 15px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-2);
}

.settings-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.settings-heading h3,
.info-admin-tools h3,
.add-account-form h3 {
  margin: 0 0 3px;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.settings-heading p,
.add-account-form p {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
}

.settings-heading p strong {
  color: var(--text);
}

.security-shield {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 13px 13px 17px 17px;
  background: linear-gradient(145deg, rgba(74, 220, 255, 0.24), rgba(91, 93, 244, 0.24));
  color: #70e7ff;
  font-weight: 900;
}

.privacy-toggle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 15px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(8, 12, 22, 0.35);
  cursor: pointer;
}

.privacy-toggle strong,
.privacy-toggle small {
  display: block;
}

.privacy-toggle strong {
  margin-bottom: 3px;
  font-size: 14px;
}

.privacy-toggle small {
  max-width: 520px;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.45;
}

.privacy-toggle input {
  position: absolute;
  opacity: 0;
}

.privacy-toggle i {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 14px;
  background: #29344b;
  transition: 160ms ease;
}

.privacy-toggle i::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  content: "";
  transition: 160ms ease;
}

.privacy-toggle input:checked + i {
  background: linear-gradient(90deg, #38c7ee, #5a72f5);
}

.privacy-toggle input:checked + i::after {
  transform: translateX(20px);
}

.email-change-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.email-code-action {
  min-width: 140px;
}

.change-email-action {
  grid-column: 1 / -1;
  justify-self: end;
}

.input-wrap input[type="date"] {
  color-scheme: dark;
}

.info-panel {
  overflow-y: auto;
}

.info-profile h3 {
  display: inline-flex;
}

.info-admin-tools {
  margin: 0 14px 18px;
  padding: 15px;
}

.info-admin-tools select {
  min-height: 42px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  outline: 0;
  background: var(--surface);
  color: var(--text);
}

.moderation-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.moderation-tools .text-button {
  min-height: 38px;
  border: 1px solid var(--line);
}

.accounts-modal {
  position: absolute;
  z-index: 71;
  top: 50%;
  left: 50%;
  width: min(620px, calc(100% - 32px));
  max-height: min(820px, calc(100% - 32px));
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  box-shadow: 0 34px 110px rgba(0, 0, 0, 0.48);
  transform: translate(-50%, -50%);
  animation: profile-modal-in 180ms ease-out;
}

.accounts-content {
  display: grid;
  gap: 20px;
  padding: 22px;
}

.accounts-list {
  display: grid;
  gap: 8px;
}

.account-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(17, 25, 42, 0.7);
}

.account-row.active {
  border-color: rgba(89, 211, 255, 0.25);
  background: linear-gradient(105deg, rgba(55, 188, 255, 0.11), rgba(106, 88, 255, 0.08));
}

.account-copy {
  min-width: 0;
}

.account-copy strong {
  display: inline-flex;
  max-width: 100%;
}

.account-copy > span {
  display: block;
  margin-top: 3px;
  color: var(--text-soft);
  font-size: 12px;
}

.account-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.account-active-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: rgba(70, 215, 169, 0.13);
  color: var(--success);
  font-weight: 800;
}

.add-account-form {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-2);
}

.add-account-form .primary-button {
  justify-self: end;
  min-width: 190px;
  padding-inline: 18px;
}

@media (max-width: 1050px) {
  :root { --sidebar-width: 338px; }
}

@media (max-width: 820px) {
  :root { --rail-width: 72px; --sidebar-width: 310px; }
  .rail-button { width: 56px; }
}

@media (max-width: 680px) {
  .chat-view { position: absolute; inset: 0; grid-template-rows: 70px auto minmax(0, 1fr) auto; }
  .conversation-header { min-height: 70px; padding-inline: 8px 10px; }
  .composer-wrap { padding-inline: 9px; }
  .profile-modal,
  .accounts-modal { width: calc(100% - 18px); max-height: calc(100% - 18px); border-radius: 20px; }
  .email-change-grid { grid-template-columns: 1fr; }
  .email-code-action,
  .change-email-action { width: 100%; grid-column: auto; justify-self: stretch; }
  .account-row { grid-template-columns: auto minmax(0, 1fr); }
  .account-actions { grid-column: 1 / -1; justify-content: flex-end; }
}

@media (max-width: 520px) {
  .auth-card { max-height: none; padding: max(34px, env(safe-area-inset-top)) 22px 28px; }
  .auth-brand { margin-bottom: 34px; }
  .profile-fields { grid-template-columns: 1fr; }
  .profile-bio-field { grid-column: auto; }
  .privacy-toggle { grid-template-columns: minmax(0, 1fr) auto; }
  .moderation-tools { grid-template-columns: 1fr; }
}

@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;
  }
}

/* Show Chat 7.0 — interface based on the compact 3.1.1 desktop layout */

:root[data-theme="dark"] {
  --bg: #050507;
  --surface: #0a0a0f;
  --surface-2: #101016;
  --surface-3: #17151f;
  --surface-hover: #17141f;
  --line: rgba(207, 185, 255, 0.1);
  --line-strong: rgba(196, 164, 255, 0.22);
  --text: #f7f5fb;
  --text-soft: #aaa4b8;
  --text-faint: #777181;
  --accent: #9b6cff;
  --accent-strong: #7f4df0;
  --accent-soft: rgba(147, 94, 255, 0.14);
  --accent-glow: rgba(143, 83, 255, 0.28);
  --message-in: rgba(23, 22, 29, 0.96);
  --message-out: #8152ef;
  --chat-background-base: #0b090c;
  --chat-glow-one: rgba(98, 26, 48, 0.34);
  --chat-glow-two: rgba(139, 70, 31, 0.16);
  --chat-pattern: rgba(218, 197, 255, 0.07);
  --rail-width: 72px;
  --sidebar-width: 344px;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.48);
}

:root[data-theme="light"] {
  --accent: #7952dc;
  --accent-strong: #6640cb;
  --accent-soft: rgba(121, 82, 220, 0.12);
  --accent-glow: rgba(121, 82, 220, 0.2);
  --message-out: #7650d8;
}

body {
  background: #050507;
}

.app-view {
  grid-template-columns: var(--rail-width) var(--sidebar-width) minmax(0, 1fr);
  gap: 8px;
  padding: 8px;
  background:
    radial-gradient(circle at 88% -20%, rgba(99, 31, 56, 0.13), transparent 36%),
    #050507;
}

.nav-rail,
.chat-sidebar,
.conversation {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
}

.nav-rail {
  padding: 15px 7px 12px;
  border-right: 1px solid var(--line);
  background: rgba(8, 8, 12, 0.98);
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-color: rgba(156, 100, 255, 0.4);
  border-radius: 15px;
  background: #0d0a18;
  box-shadow: 0 10px 28px rgba(94, 50, 197, 0.3), 0 0 0 4px rgba(130, 78, 245, 0.04);
}

.rail-actions {
  margin-top: 17px;
  gap: 7px;
}

.rail-button {
  width: 54px;
  min-height: 55px;
  border: 1px solid transparent;
  border-radius: 15px;
}

.rail-button svg {
  width: 21px;
}

.rail-button span {
  font-size: 10px;
}

.rail-button:hover,
.rail-button.active {
  border-color: rgba(155, 102, 255, 0.27);
  background: rgba(127, 75, 230, 0.13);
  box-shadow: inset 3px 0 #9a64ff;
  color: #b78fff;
}

.profile-button {
  width: 44px;
  height: 44px;
}

.chat-sidebar {
  border-right: 1px solid var(--line);
  background: rgba(8, 8, 12, 0.98);
}

.sidebar-header {
  padding: 18px 18px 12px;
}

.sidebar-title-row {
  align-items: center;
  margin: 0 1px 17px;
}

.sidebar-title-row h1 {
  margin-top: 2px;
  font-size: 25px;
  letter-spacing: -0.04em;
}

.eyebrow {
  background: none;
  color: #b79aff;
  font-size: 11px;
  letter-spacing: 0.18em;
}

.icon-button.accent {
  border: 1px solid rgba(155, 101, 255, 0.28);
  background: rgba(125, 75, 229, 0.15);
  color: #bd9bff;
}

.search-box {
  min-height: 45px;
  border-color: rgba(199, 178, 239, 0.11);
  border-radius: 14px;
  background: rgba(17, 17, 23, 0.92);
}

.chat-list {
  padding: 4px 10px 13px;
}

.chat-item,
.user-result {
  min-height: 68px;
  margin: 2px 0;
  padding: 9px 11px;
  border-radius: 16px;
}

.chat-item:hover,
.user-result:hover {
  border-color: rgba(166, 126, 244, 0.13);
  background: rgba(24, 21, 31, 0.84);
}

.chat-item.active {
  border-color: rgba(152, 101, 250, 0.3);
  background: rgba(24, 21, 31, 0.96);
  box-shadow: none;
}

.chat-item.active::before {
  left: -1px;
  width: 3px;
  height: 35px;
  background: #9b65ff;
  box-shadow: 0 0 14px rgba(154, 99, 255, 0.72);
}

.sidebar-footer {
  background: rgba(8, 8, 12, 0.96);
}

.conversation {
  background:
    radial-gradient(circle at 89% 4%, var(--chat-glow-one), transparent 38%),
    radial-gradient(circle at 15% 100%, var(--chat-glow-two), transparent 38%),
    linear-gradient(145deg, #09080a 0%, var(--chat-background-base) 58%, #0c090b 100%);
}

.conversation::before {
  background-image:
    linear-gradient(rgba(211, 191, 238, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(211, 191, 238, 0.025) 1px, transparent 1px),
    radial-gradient(circle at center, var(--chat-pattern) 1px, transparent 1.1px);
  background-size: 54px 54px, 54px 54px, 30px 30px;
  opacity: 0.45;
}

.conversation::after {
  opacity: 0.14;
  animation: none;
}

.chat-view {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  grid-template-rows: 76px auto minmax(0, 1fr) auto;
}

.conversation-header {
  min-height: 76px;
  padding: 10px 14px;
  border-bottom-color: rgba(202, 179, 244, 0.09);
  background: rgba(8, 8, 12, 0.8);
  box-shadow: none;
  backdrop-filter: blur(22px);
}

.conversation-actions {
  gap: 5px;
}

.conversation-actions .icon-button {
  border: 1px solid rgba(199, 175, 240, 0.12);
  border-radius: 13px;
  background: rgba(16, 14, 20, 0.72);
  color: #a69daf;
}

.identity-copy strong {
  font-size: 15px;
}

.message-area {
  min-height: 0;
}

.message-list {
  width: min(900px, calc(100% - 36px));
  min-height: 100%;
  padding: 30px 0 18px;
}

.day-separator {
  border-color: rgba(198, 175, 237, 0.1);
  background: rgba(14, 13, 18, 0.82);
}

.message-row {
  margin-top: 7px;
}

.message-bubble {
  max-width: min(72%, 620px);
  padding: 10px 13px 8px;
  border-color: rgba(197, 176, 231, 0.12);
  border-radius: 7px 17px 17px 17px;
  background: rgba(22, 21, 28, 0.96);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}

.message-row.outgoing .message-bubble {
  border-color: rgba(190, 148, 255, 0.28);
  border-radius: 17px 7px 17px 17px;
  background: linear-gradient(145deg, #8d5bf4, #7243dd);
  box-shadow: 0 10px 30px rgba(79, 38, 159, 0.24);
}

.message-author {
  color: #b890ff;
}

.composer-wrap {
  padding: 10px 16px max(16px, env(safe-area-inset-bottom));
  border-top: 0;
  background: linear-gradient(180deg, transparent, rgba(7, 6, 9, 0.72));
  backdrop-filter: none;
}

.message-form {
  width: min(900px, 100%);
  min-height: 50px;
  padding: 5px 7px 5px 8px;
  border-color: rgba(155, 99, 255, 0.48);
  border-radius: 17px;
  background: rgba(13, 12, 17, 0.94);
  box-shadow: 0 0 0 3px rgba(139, 83, 250, 0.06), 0 14px 40px rgba(0, 0, 0, 0.3);
}

.message-form:focus-within {
  border-color: rgba(174, 124, 255, 0.8);
  box-shadow: 0 0 0 3px rgba(139, 83, 250, 0.11), 0 14px 40px rgba(0, 0, 0, 0.3);
}

.send-button {
  position: relative;
  background: rgba(128, 78, 224, 0.16);
  box-shadow: none;
  color: #b996ff;
}

.send-button:not(:disabled) {
  background: linear-gradient(145deg, #a26aff, #7043db);
  color: #fff;
  box-shadow: 0 7px 20px rgba(91, 48, 180, 0.3);
}

.send-button[data-cooldown]:not([data-cooldown=""])::after {
  position: absolute;
  display: grid;
  inset: 0;
  place-items: center;
  color: #c9b4f5;
  content: attr(data-cooldown);
  font-size: 12px;
  font-weight: 800;
}

.send-button[data-cooldown]:not([data-cooldown=""]) svg {
  opacity: 0.08;
}

.profile-menu,
.profile-modal,
.accounts-modal,
.info-panel {
  border-color: rgba(174, 135, 246, 0.2);
  background: rgba(10, 9, 14, 0.96);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.58);
}

.account-row.active,
.security-settings,
.add-account-form,
.info-admin-tools {
  border-color: rgba(160, 112, 244, 0.18);
  background: rgba(19, 16, 25, 0.94);
}

.privacy-toggle input:checked + i {
  background: linear-gradient(90deg, #8e5cf0, #a875ff);
}

.auth-view {
  background:
    radial-gradient(circle at 12% 8%, rgba(126, 65, 223, 0.18), transparent 31%),
    radial-gradient(circle at 88% 92%, rgba(126, 47, 67, 0.17), transparent 35%),
    #060609;
}

.auth-shell {
  border-color: rgba(168, 124, 240, 0.19);
  background: rgba(10, 9, 14, 0.97);
}

.auth-art {
  background:
    radial-gradient(circle at 24% 18%, rgba(155, 96, 255, 0.29), transparent 30%),
    radial-gradient(circle at 84% 78%, rgba(143, 48, 76, 0.27), transparent 34%),
    linear-gradient(145deg, #110b20, #1a0e1d 58%, #0e0a13);
}

@media (max-width: 1050px) {
  :root[data-theme="dark"] { --sidebar-width: 318px; }
}

@media (max-width: 820px) {
  :root[data-theme="dark"] { --rail-width: 68px; --sidebar-width: 290px; }
  .app-view { gap: 6px; padding: 6px; }
}

@media (max-width: 680px) {
  .app-view { display: block; padding: 0; }
  .chat-sidebar,
  .conversation { border: 0; border-radius: 0; }
  .chat-view { height: 100%; grid-template-rows: 70px auto minmax(0, 1fr) auto; }
}

/* Show Chat 7.1 — compact messages, fixed composer and clean verification */

.nav-rail .rail-actions {
  margin-top: 0;
}

.sidebar-title-row h1 {
  margin-top: 0;
}

.verification-badge,
.verification-badge.small {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  overflow: hidden;
  clip-path: polygon(50% 0%, 61% 7%, 74% 5%, 82% 16%, 95% 22%, 93% 36%, 100% 50%, 93% 64%, 95% 78%, 82% 84%, 74% 95%, 61% 93%, 50% 100%, 38% 93%, 26% 95%, 18% 84%, 5% 78%, 7% 64%, 0 50%, 7% 36%, 5% 22%, 18% 16%, 26% 5%, 38% 7%);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.38));
}

.verification-badge.small {
  width: 14px;
  height: 14px;
  flex-basis: 14px;
}

.verification-badge svg,
.verification-badge.small svg {
  width: 100% !important;
  height: 100% !important;
  overflow: hidden;
  fill: none !important;
  stroke: none !important;
}

.verification-badge .badge-check {
  fill: none !important;
  stroke: var(--badge-check) !important;
  stroke-width: 3 !important;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.verification-badge.bronze {
  --badge-check: #ffffff;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.34), transparent 36%), #27a7eb;
  color: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.verification-badge.silver {
  --badge-check: #ffffff;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.42), transparent 40%), #858585;
  color: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.verification-badge.gold {
  --badge-check: #050505;
  background: linear-gradient(135deg, #a96f08 4%, #e5ad24 25%, #fff08b 48%, #d69c16 70%, #8d5704 100%);
  color: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 238, 147, 0.6);
  filter: drop-shadow(0 2px 5px rgba(241, 189, 50, 0.42));
}

.conversation {
  height: 100%;
  align-self: stretch;
}

.chat-view {
  position: absolute;
  inset: 0;
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.message-area {
  min-height: 0;
  overflow-y: auto;
}

.message-list {
  width: min(840px, calc(100% - 32px));
  min-height: 100%;
  justify-content: flex-end;
  padding: 22px 0 12px;
}

.message-row {
  margin-top: 4px;
}

.message-bubble,
.message-row.outgoing .message-bubble {
  display: flow-root;
  width: fit-content;
  max-width: min(62%, 520px);
  padding: 7px 10px 6px;
  border-radius: 7px 15px 15px 15px;
  backdrop-filter: none;
}

.message-row.outgoing .message-bubble {
  border-radius: 15px 7px 15px 15px;
}

.message-author {
  display: none !important;
}

.message-body {
  font-size: 13.5px;
  line-height: 1.36;
}

.message-meta {
  margin: 5px 0 -1px 9px;
  font-size: 9.5px;
}

.composer-wrap {
  position: relative;
  z-index: 5;
  align-self: end;
  padding: 8px 14px max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(202, 179, 244, 0.08);
  background: rgba(8, 8, 12, 0.93);
  backdrop-filter: blur(18px);
}

.message-form {
  width: min(760px, 100%);
  min-height: 44px;
  padding: 4px 5px 4px 7px;
  border-radius: 15px;
}

.message-form textarea {
  max-height: 110px;
  padding: 6px 3px 5px;
  font-size: 13.5px;
}

.composer-button,
.send-button {
  width: 34px;
  height: 34px;
  border-radius: 11px;
}

.composer-button svg,
.send-button svg {
  width: 20px;
}

.password-change-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.password-change-heading {
  display: grid;
  grid-column: 1 / -1;
  gap: 3px;
}

.password-change-heading strong {
  font-size: 14px;
}

.password-change-heading small {
  color: var(--text-soft);
  font-size: 11px;
}

.change-password-action {
  min-height: 45px;
  align-self: end;
}

@media (max-width: 680px) {
  .message-bubble,
  .message-row.outgoing .message-bubble {
    max-width: 84%;
  }

  .password-change-grid {
    grid-template-columns: 1fr;
  }

  .password-change-heading {
    grid-column: auto;
  }
}
