@font-face {
  font-family: "Vazirmatn";
  src: url("/fonts/Vazirmatn-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 100 600;
  font-display: swap;
}

@font-face {
  font-family: "Vazirmatn";
  src: url("/fonts/Vazirmatn-Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --font: "Vazirmatn", Tahoma, Arial, sans-serif;
  --cobalt-50: #eff5ff;
  --cobalt-100: #dceaff;
  --cobalt-200: #b9d5ff;
  --cobalt-400: #5598ff;
  --cobalt-500: #3478f6;
  --cobalt-600: #235fe0;
  --cobalt-700: #1d4bc0;
  --navy-950: #071332;
  --navy-900: #0b1b45;
  --ink: #17213a;
  --ink-soft: #5f6b85;
  --ink-faint: #929db1;
  --line: #e6ebf4;
  --surface: #ffffff;
  --surface-soft: #f7f9fd;
  --surface-blue: #f0f5ff;
  --success: #2bc98a;
  --danger: #ef596f;
  --warning: #ffb84d;
  --shadow-sm: 0 3px 14px rgba(35, 53, 96, 0.07);
  --shadow-md: 0 14px 42px rgba(25, 45, 91, 0.12);
  --shadow-lg: 0 32px 90px rgba(0, 16, 61, 0.26);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--surface);
}

button,
input,
textarea {
  font: inherit;
}

button,
a,
label[for] {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:not(:disabled),
a,
label[for] {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(52, 120, 246, 0.28);
  outline-offset: 2px;
}

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

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

svg {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  fill: currentColor;
}

img {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

::selection {
  color: #fff;
  background: var(--cobalt-500);
}

/* Login */

.login-page {
  position: relative;
  overflow-x: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 12% 10%, rgba(66, 127, 255, 0.22), transparent 31rem),
    linear-gradient(132deg, #06112e, #0b1d4b 55%, #102966);
}

.noise {
  position: fixed;
  z-index: 1;
  inset: 0;
  pointer-events: none;
  opacity: 0.13;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.22'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.ambient {
  position: fixed;
  z-index: 0;
  width: 32rem;
  height: 32rem;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(4px);
  opacity: 0.65;
}

.ambient-one {
  top: -17rem;
  right: 25%;
  background: radial-gradient(circle, rgba(65, 137, 255, 0.45), transparent 70%);
}

.ambient-two {
  bottom: -22rem;
  left: -9rem;
  background: radial-gradient(circle, rgba(19, 207, 234, 0.2), transparent 70%);
}

.login-shell {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(420px, 1.05fr) minmax(430px, 0.95fr);
  min-height: 100vh;
}

.login-showcase {
  position: relative;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  overflow: hidden;
  padding: clamp(2rem, 4vw, 4rem) clamp(2.2rem, 5vw, 5.5rem);
  isolation: isolate;
}

.login-showcase::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle, #000 0, transparent 72%);
}

.showcase-top,
.showcase-foot {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
}

.brand img {
  flex: 0 0 auto;
  border-radius: 14px;
  box-shadow: 0 9px 20px rgba(34, 91, 235, 0.23);
}

.brand span {
  display: grid;
  line-height: 1.25;
}

.brand b {
  font-size: 1.16rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand small {
  color: var(--ink-faint);
  font-size: 0.66rem;
}

.brand-light small {
  color: rgba(255, 255, 255, 0.5);
}

.secure-pill {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.48rem 0.72rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.73);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.09);
  font-size: 0.72rem;
  backdrop-filter: blur(16px);
}

.secure-pill svg {
  width: 0.95rem;
  height: 0.95rem;
  color: #69dcb5;
}

.showcase-copy {
  position: relative;
  z-index: 3;
  width: min(100%, 600px);
  margin-top: clamp(3rem, 8vh, 6.6rem);
}

.showcase-copy .eyebrow {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0 0 1rem;
  color: #7db6ff;
  font-size: 0.78rem;
  font-weight: 600;
}

.eyebrow span {
  width: 1.8rem;
  height: 1px;
  background: #5e9fff;
}

.showcase-copy h1 {
  margin: 0;
  font-size: clamp(2.7rem, 4.4vw, 5rem);
  font-weight: 800;
  letter-spacing: -0.055em;
  line-height: 1.25;
}

.showcase-copy h1 em {
  color: transparent;
  background: linear-gradient(90deg, #76b6ff, #66e0e0);
  background-clip: text;
  font-style: normal;
}

.showcase-copy > p:last-child {
  max-width: 36rem;
  margin: 1.25rem 0 0;
  color: rgba(224, 235, 255, 0.62);
  font-size: clamp(0.86rem, 1.3vw, 1.05rem);
  line-height: 2;
}

.showcase-art {
  position: absolute;
  z-index: 1;
  right: 34%;
  bottom: -3%;
  width: min(44vw, 590px);
  margin: 0;
  transform: translateX(35%);
}

.showcase-art::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(0deg, #09193e 1%, transparent 28%);
}

.showcase-art > img {
  width: 100%;
  border: 1px solid rgba(100, 164, 255, 0.12);
  border-radius: 50%;
  box-shadow: 0 0 80px rgba(35, 98, 245, 0.23);
  opacity: 0.77;
  mix-blend-mode: screen;
  animation: art-float 7s ease-in-out infinite;
}

.art-glow {
  position: absolute;
  z-index: -1;
  inset: 18%;
  border-radius: 50%;
  background: #225bde;
  filter: blur(70px);
  opacity: 0.5;
}

@keyframes art-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-12px);
  }
}

.floating-note {
  position: absolute;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 0.66rem;
  padding: 0.68rem 0.78rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  background: rgba(9, 29, 74, 0.67);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2), inset 0 1px rgba(255, 255, 255, 0.08);
  font-size: 0.66rem;
  backdrop-filter: blur(18px);
}

.floating-note > span:not(.mini-avatar, .online-dot) {
  display: grid;
  line-height: 1.55;
}

.floating-note b {
  font-size: 0.7rem;
}

.floating-note small {
  color: rgba(255, 255, 255, 0.54);
}

.note-one {
  top: 37%;
  left: -7%;
  min-width: 182px;
  animation: note-float 5.2s 0.4s ease-in-out infinite;
}

.note-one i {
  align-self: flex-start;
  width: 0.38rem;
  height: 0.38rem;
  margin-inline-start: auto;
  border-radius: 50%;
  background: var(--success);
}

.note-two {
  right: -5%;
  bottom: 17%;
  animation: note-float 5.7s ease-in-out infinite reverse;
}

.online-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(43, 201, 138, 0.12);
}

.mini-avatar {
  display: grid;
  width: 2.15rem;
  height: 2.15rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 11px;
  font-size: 0.78rem;
  font-weight: 700;
}

@keyframes note-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

.showcase-foot {
  z-index: 5;
  margin-top: auto;
  justify-content: flex-start;
  gap: 0.9rem;
}

.avatar-stack {
  display: flex;
  direction: ltr;
}

.avatar-stack span {
  display: grid;
  width: 2.2rem;
  height: 2.2rem;
  margin-left: -0.55rem;
  place-items: center;
  border: 2px solid #0d2253;
  border-radius: 50%;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
}

.avatar-stack span:first-child {
  margin-left: 0;
}

.avatar-blue {
  color: #fff !important;
  background: linear-gradient(145deg, #69a9ff, #356fe5) !important;
}

.avatar-pink {
  color: #fff !important;
  background: linear-gradient(145deg, #ff92ac, #db527c) !important;
}

.avatar-gold {
  color: #fff !important;
  background: linear-gradient(145deg, #ffc75d, #e89532) !important;
}

.avatar-mint {
  color: #fff !important;
  background: linear-gradient(145deg, #63dcc1, #24a989) !important;
}

.avatar-purple {
  color: #fff !important;
  background: linear-gradient(145deg, #b38cff, #7359db) !important;
}

.avatar-red {
  color: #fff !important;
  background: linear-gradient(145deg, #ff8c85, #e35555) !important;
}

.avatar-sky {
  color: #fff !important;
  background: linear-gradient(145deg, #5ecbec, #268bb9) !important;
}

.showcase-foot p {
  display: grid;
  margin: 0;
  line-height: 1.45;
}

.showcase-foot b {
  font-size: 0.78rem;
}

.showcase-foot p span {
  color: rgba(255, 255, 255, 0.42);
  font-size: 0.64rem;
}

.auth-panel {
  position: relative;
  display: grid;
  min-height: 100vh;
  padding: clamp(2rem, 5vw, 5.5rem);
  place-items: center;
  border-radius: 0 0 0 0;
  color: var(--ink);
  background: rgba(249, 251, 255, 0.98);
  box-shadow: -40px 0 90px rgba(0, 10, 43, 0.23);
}

.auth-card {
  width: min(100%, 430px);
}

.mobile-brand {
  display: none;
}

.auth-heading {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2.1rem;
}

.welcome-icon {
  display: grid;
  width: 3.15rem;
  height: 3.15rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--cobalt-100);
  border-radius: 16px;
  color: var(--cobalt-500);
  background: var(--cobalt-50);
}

.welcome-icon svg {
  width: 1.42rem;
  height: 1.42rem;
}

.auth-heading h2 {
  margin: 0 0 0.25rem;
  font-size: clamp(1.65rem, 2.8vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.045em;
}

.auth-heading p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.83rem;
}

.auth-form {
  display: grid;
  gap: 1.2rem;
}

.field {
  display: grid;
  gap: 0.48rem;
}

.field > span:first-child {
  color: #364058;
  font-size: 0.77rem;
  font-weight: 650;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  height: 3.45rem;
  border: 1px solid #dce2ee;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(20, 36, 75, 0.02);
  transition: 180ms ease;
}

.input-wrap:focus-within {
  border-color: var(--cobalt-400);
  box-shadow: 0 0 0 4px rgba(52, 120, 246, 0.09);
}

.field.has-error .input-wrap {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px rgba(239, 89, 111, 0.08);
}

.input-wrap > svg {
  width: 1.12rem;
  height: 1.12rem;
  margin-inline-start: 1rem;
  color: #9aa5b9;
}

.input-wrap input {
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 0 0.75rem;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 0.83rem;
}

.input-wrap input::placeholder {
  color: #abb4c4;
}

.password-toggle {
  display: grid;
  width: 3.2rem;
  height: 100%;
  padding: 0;
  place-items: center;
  border: 0;
  color: #919caf;
  background: transparent;
}

.password-toggle:hover {
  color: var(--cobalt-500);
}

.password-toggle svg {
  width: 1.15rem;
}

.field-error {
  min-height: 1rem;
  color: var(--danger);
  font-size: 0.66rem;
}

.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: -0.3rem;
  font-size: 0.71rem;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink-soft);
  user-select: none;
}

.check-label input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.fake-check {
  display: grid;
  width: 1.15rem;
  height: 1.15rem;
  place-items: center;
  border: 1.5px solid #ccd4e2;
  border-radius: 5px;
  background: #fff;
  transition: 160ms ease;
}

.fake-check svg {
  width: 0.8rem;
  height: 0.8rem;
  fill: none;
  stroke: #fff;
  stroke-width: 3;
  opacity: 0;
}

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

.check-label input:checked + .fake-check svg {
  opacity: 1;
}

.check-label input:focus-visible + .fake-check {
  outline: 3px solid rgba(52, 120, 246, 0.22);
  outline-offset: 2px;
}

.text-button,
.signup-line button {
  padding: 0;
  border: 0;
  color: var(--cobalt-600);
  background: transparent;
  font-size: inherit;
  font-weight: 650;
}

.text-button:hover,
.signup-line button:hover {
  color: var(--cobalt-700);
  text-decoration: underline;
}

.primary-button {
  display: flex;
  height: 3.45rem;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, #387ff8, #245ad5);
  box-shadow: 0 13px 25px rgba(35, 95, 224, 0.23);
  font-size: 0.83rem;
  font-weight: 700;
  transition: transform 180ms var(--ease), box-shadow 180ms ease;
}

.primary-button:hover {
  box-shadow: 0 16px 30px rgba(35, 95, 224, 0.32);
  transform: translateY(-2px);
}

.primary-button:active {
  transform: translateY(0);
}

.primary-button svg {
  width: 1.05rem;
  height: 1.05rem;
  transform: scaleX(-1);
}

.button-loader {
  display: none;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.38);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.login-button.loading span,
.login-button.loading svg {
  display: none;
}

.login-button.loading .button-loader {
  display: block;
}

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

.demo-login {
  display: flex;
  width: 100%;
  min-height: 4.2rem;
  align-items: center;
  gap: 0.72rem;
  margin-top: 1.35rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  text-align: right;
  background: rgba(255, 255, 255, 0.64);
  transition: 180ms ease;
}

.demo-login:hover {
  border-color: var(--cobalt-200);
  background: #fff;
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.demo-icon {
  display: grid;
  width: 2.6rem;
  height: 2.6rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 11px;
  color: var(--cobalt-500);
  background: var(--cobalt-50);
}

.demo-icon svg {
  width: 1.15rem;
}

.demo-login > span:nth-child(2) {
  display: grid;
  line-height: 1.55;
}

.demo-login b {
  font-size: 0.73rem;
}

.demo-login small {
  color: var(--ink-faint);
  font-size: 0.63rem;
}

.demo-login .chevron {
  width: 0.95rem;
  margin-inline-start: auto;
  color: #9ba6b9;
}

.local-test-panel {
  margin-top: 0.85rem;
  padding: 0.72rem;
  border: 1px solid #dce7fa;
  border-radius: 14px;
  background: linear-gradient(135deg, #f4f8ff, #f8fbff);
}

.local-test-panel > div:first-child {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.62rem;
}

.local-test-panel > div:first-child > span:nth-child(2) {
  display: grid;
  line-height: 1.5;
}

.local-test-panel b {
  font-size: 0.65rem;
}

.local-test-panel small {
  color: var(--ink-faint);
  font-size: 0.54rem;
}

.live-indicator {
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(43, 201, 138, 0.1);
  animation: live-pulse 1.8s ease-in-out infinite;
}

@keyframes live-pulse {
  50% {
    box-shadow: 0 0 0 7px rgba(43, 201, 138, 0.03);
  }
}

.local-users {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.48rem;
}

.local-users a {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.45rem;
  padding: 0.48rem;
  border: 1px solid #e1e7f2;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.88);
  transition: 160ms ease;
}

.local-users a:hover {
  border-color: var(--cobalt-200);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.local-users .mini-avatar {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 9px;
  font-size: 0.65rem;
}

.local-users a > span:last-child {
  display: grid;
  min-width: 0;
  line-height: 1.4;
}

.signup-line {
  margin: 1.7rem 0 0;
  color: var(--ink-soft);
  text-align: center;
  font-size: 0.72rem;
}

.auth-footer {
  position: absolute;
  right: clamp(2rem, 5vw, 5.5rem);
  bottom: 1.7rem;
  left: clamp(2rem, 5vw, 5.5rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #9ca6b6;
  font-size: 0.61rem;
}

.auth-footer > span:last-child {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.auth-footer i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #bbc2ce;
}

.auth-footer a:hover {
  color: var(--cobalt-500);
}

/* Messenger shell */

.chat-page {
  height: 100dvh;
  overflow: hidden;
  background: #edf2fb;
}

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

.sidebar {
  position: relative;
  z-index: 25;
  display: flex;
  width: 340px;
  min-width: 300px;
  flex: 0 0 340px;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
}

.sidebar-header {
  display: flex;
  height: 76px;
  flex: 0 0 76px;
  align-items: center;
  gap: 0.8rem;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--line);
}

.sidebar-header .brand {
  margin-inline-end: auto;
}

.sidebar-header .brand img {
  width: 2.55rem;
  height: 2.55rem;
}

.icon-button {
  display: grid;
  width: 2.55rem;
  height: 2.55rem;
  flex: 0 0 auto;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 12px;
  color: #707c93;
  background: transparent;
  transition: 160ms ease;
}

.icon-button:hover {
  color: var(--cobalt-600);
  background: var(--cobalt-50);
}

.icon-button svg {
  width: 1.15rem;
  height: 1.15rem;
}

.subtle-button {
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.subtle-button svg,
.mobile-close svg,
.chat-header .icon-button:last-child svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.mobile-close {
  display: none;
}

.current-user {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0.9rem 1rem 0.7rem;
  padding: 0.78rem;
  border: 1px solid #e6ebf5;
  border-radius: 16px;
  background: linear-gradient(135deg, #f8faff, #f2f6ff);
}

.avatar {
  position: relative;
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(145deg, #6a91ec, #345ab7);
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.3);
}

.avatar-user {
  background: linear-gradient(145deg, #72a8ff, #2c63d9);
}

.status-dot {
  position: absolute;
  right: -2px;
  bottom: -1px;
  width: 0.7rem;
  height: 0.7rem;
  border: 2px solid #fff;
  border-radius: 50%;
}

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

.status-dot.away {
  background: var(--warning);
}

.status-dot.offline {
  background: #aab3c3;
}

.current-user > div:nth-child(2) {
  display: grid;
  min-width: 0;
  line-height: 1.4;
}

.current-user strong {
  overflow: hidden;
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.current-user #editStatus {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0;
  border: 0;
  color: var(--ink-faint);
  background: transparent;
  font-size: 0.62rem;
}

.current-user #editStatus svg {
  width: 0.75rem;
}

.status-mini {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--success);
}

.menu-button {
  width: 2rem;
  height: 2rem;
  margin-inline-start: auto;
}

.menu-button svg {
  width: 1.08rem;
}

.popover {
  position: absolute;
  z-index: 80;
  top: calc(100% - 0.25rem);
  left: 0;
  width: 175px;
  padding: 0.38rem;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  animation: pop-in 160ms var(--ease);
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(-5px) scale(0.98);
  }
}

.popover button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.62rem;
  border: 0;
  border-radius: 9px;
  text-align: right;
  background: transparent;
  font-size: 0.69rem;
}

.popover button:hover {
  background: var(--surface-soft);
}

.popover button svg {
  width: 0.96rem;
  height: 0.96rem;
  color: #77839b;
}

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

.popover .danger-item svg {
  color: currentColor;
}

.contact-search {
  position: relative;
  display: flex;
  height: 2.8rem;
  flex: 0 0 2.8rem;
  align-items: center;
  margin: 0.15rem 1rem 0.75rem;
  border: 1px solid #e4e9f3;
  border-radius: 12px;
  background: #f6f8fc;
  transition: 160ms ease;
}

.contact-search:focus-within {
  border-color: var(--cobalt-300, #8bb9ff);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(52, 120, 246, 0.08);
}

.contact-search svg {
  width: 1rem;
  margin-inline-start: 0.8rem;
  color: #9aa5b8;
}

.contact-search input {
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 0 0.55rem;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 0.69rem;
}

.contact-search input::placeholder {
  color: #a2acbc;
}

.contact-search kbd {
  margin-inline-end: 0.55rem;
  padding: 0.16rem 0.38rem;
  border: 1px solid #dce2ec;
  border-radius: 5px;
  color: #a0a9b8;
  background: #fff;
  box-shadow: 0 1px #e3e7ee;
  direction: ltr;
  font-family: inherit;
  font-size: 0.52rem;
  white-space: nowrap;
}

.list-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0 1rem 0.8rem;
  border-bottom: 1px solid var(--line);
}

.list-tabs button {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.43rem 0.62rem;
  border: 0;
  border-radius: 9px;
  color: #818ca0;
  background: transparent;
  font-size: 0.64rem;
  white-space: nowrap;
}

.list-tabs button:hover {
  color: var(--ink);
  background: var(--surface-soft);
}

.list-tabs button.active {
  color: var(--cobalt-600);
  background: var(--cobalt-50);
  font-weight: 700;
}

.list-tabs span {
  display: grid;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 0.2rem;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--cobalt-500);
  font-size: 0.52rem;
}

.contact-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.15rem 0.45rem;
  color: #7b879c;
  font-size: 0.61rem;
}

.contact-section-head > span {
  font-weight: 650;
}

.contact-section-head button {
  display: flex;
  align-items: center;
  gap: 0.18rem;
  padding: 0;
  border: 0;
  color: #99a3b4;
  background: transparent;
  font-size: 0.57rem;
}

.contact-section-head svg {
  width: 0.67rem;
}

.contacts-list {
  min-height: 0;
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 0.55rem 0.65rem;
  scrollbar-color: #dce3ef transparent;
  scrollbar-width: thin;
}

.contact-item {
  position: relative;
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.7rem;
  padding: 0.72rem 0.65rem;
  border: 0;
  border-radius: 14px;
  text-align: right;
  background: transparent;
  transition: 150ms ease;
}

.contact-item:hover {
  background: #f7f9fd;
}

.contact-item.active {
  background: linear-gradient(135deg, #eef4ff, #e9f1ff);
}

.contact-item.active::before {
  position: absolute;
  top: 28%;
  right: -0.55rem;
  bottom: 28%;
  width: 3px;
  border-radius: 4px 0 0 4px;
  background: var(--cobalt-500);
  content: "";
}

.contact-item .avatar {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 13px;
  font-size: 0.8rem;
}

.contact-main {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 0.28rem;
}

.contact-line {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}

.contact-line strong {
  overflow: hidden;
  font-size: 0.72rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-time {
  flex: 0 0 auto;
  color: #a1aabb;
  direction: rtl;
  font-size: 0.53rem;
}

.contact-preview {
  overflow: hidden;
  color: #8a95a8;
  font-size: 0.61rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-preview.you::before {
  color: var(--cobalt-500);
  content: "شما: ";
}

.unread-badge {
  display: grid;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.3rem;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--cobalt-500);
  font-size: 0.52rem;
  font-weight: 700;
}

.read-mark {
  flex: 0 0 auto;
  color: var(--cobalt-500);
  font-size: 0.7rem;
  letter-spacing: -0.3em;
  transform: translateX(-0.15rem);
}

.empty-contacts {
  display: grid;
  height: 12rem;
  place-items: center;
  color: var(--ink-faint);
  text-align: center;
  font-size: 0.68rem;
}

.empty-contacts svg {
  width: 2rem;
  height: 2rem;
  margin: 0 auto 0.5rem;
  opacity: 0.5;
}

.sidebar-footer {
  display: flex;
  height: 66px;
  flex: 0 0 66px;
  align-items: center;
  justify-content: space-around;
  padding: 0 0.5rem;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
}

.sidebar-footer button {
  display: grid;
  min-width: 4.2rem;
  gap: 0.2rem;
  padding: 0.4rem;
  place-items: center;
  border: 0;
  border-radius: 10px;
  color: #929caf;
  background: transparent;
  font-size: 0.54rem;
}

.sidebar-footer button:hover,
.sidebar-footer button.active {
  color: var(--cobalt-600);
  background: var(--cobalt-50);
}

.sidebar-footer svg {
  width: 1.05rem;
  height: 1.05rem;
}

/* Conversation */

.chat-workspace {
  position: relative;
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  background: #f7f9fd;
}

.chat-header {
  position: relative;
  z-index: 15;
  display: flex;
  height: 76px;
  flex: 0 0 76px;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1rem, 2.5vw, 2rem);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
}

.chat-person {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.75rem;
}

.mobile-menu {
  display: none;
}

.chat-person .avatar {
  width: 2.7rem;
  height: 2.7rem;
  border-radius: 14px;
}

.chat-person > div:last-child {
  min-width: 0;
}

.chat-person h1 {
  overflow: hidden;
  margin: 0 0 0.12rem;
  font-size: 0.83rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-person p {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
  color: var(--success);
  font-size: 0.59rem;
}

.chat-person p span {
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: currentColor;
}

.chat-actions {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.chat-actions .icon-button {
  width: 2.4rem;
  height: 2.4rem;
}

.header-separator {
  width: 1px;
  height: 1.4rem;
  margin: 0 0.3rem;
  background: var(--line);
}

.conversation-search-bar {
  position: absolute;
  z-index: 14;
  top: 76px;
  right: 0;
  left: 0;
  display: flex;
  height: 54px;
  align-items: center;
  padding: 0 1.4rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  animation: search-slide 180ms var(--ease);
}

@keyframes search-slide {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
}

.conversation-search-bar > svg {
  width: 1rem;
  color: #93a0b5;
}

.conversation-search-bar input {
  min-width: 0;
  flex: 1;
  padding: 0 0.7rem;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 0.72rem;
}

.conversation-search-bar span {
  margin-inline-end: 0.5rem;
  color: var(--ink-faint);
  font-size: 0.6rem;
}

.conversation-search-bar button {
  display: grid;
  width: 2rem;
  height: 2rem;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: #8490a5;
  background: transparent;
}

.conversation-search-bar button:hover {
  background: var(--surface-soft);
}

.conversation-search-bar button svg {
  width: 0.9rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
}

.messages-scroll {
  position: relative;
  min-height: 0;
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #d9e2f1 transparent;
  scrollbar-width: thin;
}

.messages-background {
  position: fixed;
  z-index: 0;
  inset: 76px 0 90px 340px;
  pointer-events: none;
  opacity: 0.72;
  background:
    radial-gradient(circle at 85% 20%, rgba(78, 140, 255, 0.08), transparent 30%),
    radial-gradient(circle at 20% 75%, rgba(72, 210, 196, 0.06), transparent 30%);
}

.messages-background::after {
  position: absolute;
  inset: 0;
  content: "";
  opacity: 0.28;
  background-image: url("data:image/svg+xml,%3Csvg width='88' height='88' viewBox='0 0 88 88' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%239cafca' stroke-width='.8' opacity='.24'%3E%3Cpath d='M13 23c0-4 3-7 7-7h9c4 0 7 3 7 7v5c0 4-3 7-7 7h-5l-6 5v-5c-3-1-5-3-5-7v-5Z'/%3E%3Cpath d='M59 57h2M64 57h2M69 57h2'/%3E%3Ccircle cx='66' cy='58' r='13'/%3E%3C/g%3E%3C/svg%3E");
}

.messages-list {
  position: relative;
  z-index: 1;
  width: min(100%, 880px);
  min-height: 100%;
  margin: 0 auto;
  padding: 1.4rem clamp(1rem, 4vw, 3rem) 1rem;
}

.date-divider {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0.55rem auto 1.2rem;
  color: #97a3b7;
  font-size: 0.56rem;
}

.date-divider::before,
.date-divider::after {
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, transparent, #e1e7f0);
  content: "";
}

.date-divider::after {
  background: linear-gradient(90deg, #e1e7f0, transparent);
}

.message-row {
  display: flex;
  align-items: flex-end;
  gap: 0.52rem;
  margin: 0.35rem 0;
  direction: ltr;
  animation: message-in 220ms var(--ease);
}

.message-row.incoming {
  justify-content: flex-start;
}

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

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(7px) scale(0.985);
  }
}

.message-row .message-avatar {
  width: 1.8rem;
  height: 1.8rem;
  margin-bottom: 0.15rem;
  border-radius: 9px;
  font-size: 0.6rem;
}

.message-row.grouped .message-avatar {
  visibility: hidden;
}

.message-wrap {
  position: relative;
  display: grid;
  max-width: min(72%, 520px);
}

.message-bubble {
  position: relative;
  padding: 0.62rem 0.78rem 0.42rem;
  border: 1px solid #e6ebf2;
  border-radius: 16px 16px 16px 4px;
  color: #354057;
  background: #fff;
  box-shadow: 0 3px 11px rgba(29, 46, 86, 0.05);
  direction: rtl;
}

.outgoing .message-bubble {
  border-color: transparent;
  border-radius: 16px 16px 4px;
  color: #fff;
  background: linear-gradient(145deg, #3f84f8, #2863df);
  box-shadow: 0 6px 16px rgba(42, 100, 223, 0.16);
}

.message-bubble p {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  font-size: 0.72rem;
  line-height: 1.85;
}

.message-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.28rem;
  margin-top: 0.16rem;
  color: #a1aabc;
  direction: ltr;
  font-size: 0.49rem;
}

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

.message-checks {
  color: #d7ecff;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: -0.27em;
  transform: translateX(-0.15rem);
}

.reply-quote {
  margin-bottom: 0.48rem;
  padding: 0.38rem 0.55rem;
  border-right: 3px solid #72a7ff;
  border-radius: 6px;
  color: #6b7790;
  background: #f4f7fd;
  font-size: 0.6rem;
}

.reply-quote b {
  display: block;
  margin-bottom: 0.1rem;
  color: var(--cobalt-600);
  font-size: 0.56rem;
}

.outgoing .reply-quote {
  border-right-color: rgba(255, 255, 255, 0.72);
  color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.13);
}

.outgoing .reply-quote b {
  color: #fff;
}

.file-bubble {
  display: flex;
  min-width: 230px;
  align-items: center;
  gap: 0.65rem;
}

.file-bubble > span:first-child {
  display: grid;
  width: 2.6rem;
  height: 2.6rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 11px;
  color: var(--cobalt-600);
  background: var(--cobalt-50);
}

.outgoing .file-bubble > span:first-child {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
}

.file-bubble svg {
  width: 1.2rem;
  height: 1.2rem;
}

.file-bubble > span:nth-child(2) {
  display: grid;
  min-width: 0;
  flex: 1;
}

.file-bubble b {
  overflow: hidden;
  font-size: 0.65rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-bubble small {
  color: #9aa5b6;
  font-size: 0.54rem;
}

.outgoing .file-bubble small {
  color: rgba(255, 255, 255, 0.65);
}

.file-download {
  display: grid;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: #7d8aa1;
  background: #f2f5fb;
}

.outgoing .file-download {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}

.file-download svg {
  width: 0.9rem;
}

.message-actions {
  position: absolute;
  top: 50%;
  display: flex;
  gap: 0.12rem;
  padding: 0.18rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) scale(0.96);
  transition: 140ms ease;
}

.incoming .message-actions {
  right: calc(100% + 0.45rem);
}

.outgoing .message-actions {
  left: calc(100% + 0.45rem);
}

.message-wrap:hover .message-actions,
.message-actions:focus-within {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) scale(1);
}

.message-actions button {
  display: grid;
  width: 1.65rem;
  height: 1.65rem;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 6px;
  color: #8a95a7;
  background: transparent;
}

.message-actions button:hover {
  color: var(--cobalt-600);
  background: var(--cobalt-50);
}

.message-actions svg {
  width: 0.78rem;
  height: 0.78rem;
}

.message-reaction {
  position: absolute;
  right: 0.45rem;
  bottom: -0.72rem;
  display: flex;
  min-width: 2rem;
  height: 1.3rem;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  padding: 0 0.32rem;
  border: 2px solid #f7f9fd;
  border-radius: 999px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  font-size: 0.68rem;
}

.message-reaction small {
  color: #7d8798;
  font-size: 0.48rem;
}

.search-highlight {
  color: inherit;
  background: #ffdf71;
  border-radius: 2px;
}

.outgoing .search-highlight {
  color: #223152;
}

.empty-conversation {
  display: grid;
  min-height: 60vh;
  place-items: center;
  color: var(--ink-faint);
  text-align: center;
}

.empty-conversation span {
  display: grid;
  width: 4rem;
  height: 4rem;
  margin: 0 auto 0.8rem;
  place-items: center;
  border-radius: 22px;
  color: var(--cobalt-500);
  background: var(--cobalt-50);
}

.empty-conversation svg {
  width: 1.8rem;
  height: 1.8rem;
}

.empty-conversation h3 {
  margin: 0 0 0.25rem;
  color: var(--ink);
  font-size: 0.85rem;
}

.empty-conversation p {
  margin: 0;
  font-size: 0.65rem;
}

.scroll-bottom {
  position: sticky;
  z-index: 10;
  right: calc(100% - 3.6rem);
  bottom: 0.8rem;
  display: grid;
  width: 2.45rem;
  height: 2.45rem;
  margin: -3rem 0 0.7rem 0.8rem;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--cobalt-600);
  background: #fff;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: 180ms ease;
}

.scroll-bottom.visible {
  opacity: 1;
  pointer-events: auto;
}

.scroll-bottom svg {
  width: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
}

.scroll-bottom span {
  position: absolute;
  top: -0.25rem;
  right: -0.22rem;
  display: grid;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.2rem;
  place-items: center;
  border: 2px solid #f7f9fd;
  border-radius: 999px;
  color: #fff;
  background: var(--danger);
  font-size: 0.47rem;
}

.typing-row {
  position: absolute;
  z-index: 8;
  right: clamp(1rem, 5vw, 4.5rem);
  bottom: 92px;
  display: flex;
  align-items: center;
  gap: 0.42rem;
  color: #8b96a8;
  font-size: 0.55rem;
}

.typing-avatar {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 8px;
  font-size: 0.54rem;
}

.typing-bubble {
  display: flex;
  gap: 0.16rem;
  padding: 0.55rem 0.62rem;
  border: 1px solid var(--line);
  border-radius: 11px 11px 3px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.typing-bubble i {
  width: 0.27rem;
  height: 0.27rem;
  border-radius: 50%;
  background: #8f9bad;
  animation: typing 1.2s infinite;
}

.typing-bubble i:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-bubble i:nth-child(3) {
  animation-delay: 0.3s;
}

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

.composer-area {
  position: relative;
  z-index: 12;
  flex: 0 0 auto;
  padding: 0.7rem clamp(0.8rem, 3vw, 2.2rem) 0.55rem;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(18px);
}

.composer {
  display: flex;
  width: min(100%, 880px);
  min-height: 3rem;
  align-items: flex-end;
  gap: 0.45rem;
  margin: 0 auto;
}

.message-input-wrap {
  display: flex;
  min-width: 0;
  min-height: 3rem;
  flex: 1;
  align-items: flex-end;
  border: 1px solid #e0e6f0;
  border-radius: 15px;
  background: #f7f9fd;
  transition: 160ms ease;
}

.message-input-wrap:focus-within {
  border-color: var(--cobalt-300, #8bb9ff);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(52, 120, 246, 0.07);
}

.message-input-wrap textarea {
  width: 100%;
  max-height: 110px;
  min-height: 2.9rem;
  min-width: 0;
  resize: none;
  padding: 0.82rem 0.95rem 0.55rem 0.25rem;
  overflow-y: auto;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 0.7rem;
  line-height: 1.55;
}

.message-input-wrap textarea::placeholder {
  color: #a4adbc;
}

.composer-icon {
  display: grid;
  width: 2.7rem;
  height: 3rem;
  flex: 0 0 auto;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 12px;
  color: #8290a7;
  background: transparent;
  transition: 150ms ease;
}

.composer-icon:hover {
  color: var(--cobalt-600);
  background: var(--cobalt-50);
}

.composer-icon svg {
  width: 1.2rem;
  height: 1.2rem;
}

.emoji-button {
  width: 2.6rem;
  font-family: Arial, sans-serif;
  font-size: 1.2rem;
}

.voice-button,
.send-button {
  display: grid;
  width: 3rem;
  height: 3rem;
  flex: 0 0 auto;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 14px;
  color: var(--cobalt-600);
  background: var(--cobalt-50);
  transition: 160ms ease;
}

.voice-button:hover {
  color: #fff;
  background: var(--cobalt-500);
}

.voice-button.recording {
  color: #fff;
  background: var(--danger);
  box-shadow: 0 0 0 5px rgba(239, 89, 111, 0.13);
  animation: record-pulse 1.4s infinite;
}

@keyframes record-pulse {
  50% {
    box-shadow: 0 0 0 9px rgba(239, 89, 111, 0.05);
  }
}

.send-button {
  color: #fff;
  background: linear-gradient(145deg, #3e84fa, #275fd9);
  box-shadow: 0 8px 18px rgba(41, 96, 218, 0.2);
}

.send-button:hover {
  transform: translateY(-2px) rotate(-2deg);
  box-shadow: 0 11px 22px rgba(41, 96, 218, 0.28);
}

.send-button svg {
  width: 1.12rem;
  height: 1.12rem;
  transform: scaleX(-1);
}

.composer-hint {
  width: min(100%, 880px);
  margin: 0.25rem auto 0;
  color: #adb5c3;
  text-align: center;
  direction: ltr;
  font-size: 0.48rem;
}

.emoji-picker {
  position: absolute;
  z-index: 40;
  right: clamp(3rem, 9vw, 7rem);
  bottom: calc(100% + 0.5rem);
  width: 290px;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-md);
  animation: picker-in 180ms var(--ease);
}

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

.emoji-picker header {
  display: grid;
  margin-bottom: 0.7rem;
  line-height: 1.55;
}

.emoji-picker header b {
  font-size: 0.68rem;
}

.emoji-picker header span {
  color: var(--ink-faint);
  font-size: 0.54rem;
}

.emoji-picker > div {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.2rem;
}

.emoji-picker button {
  display: grid;
  aspect-ratio: 1;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-family: Arial, sans-serif;
  font-size: 1.18rem;
}

.emoji-picker button:hover {
  background: var(--cobalt-50);
  transform: scale(1.12);
}

.reply-preview,
.file-preview {
  display: flex;
  width: min(100%, 880px);
  min-height: 3rem;
  align-items: center;
  gap: 0.7rem;
  margin: 0 auto 0.5rem;
  padding: 0.5rem 0.7rem;
  border-right: 3px solid var(--cobalt-500);
  border-radius: 10px;
  background: var(--cobalt-50);
}

.reply-preview > div {
  min-width: 0;
  flex: 1;
}

.reply-preview b {
  display: block;
  color: var(--cobalt-600);
  font-size: 0.58rem;
}

.reply-preview p {
  overflow: hidden;
  margin: 0.12rem 0 0;
  color: var(--ink-soft);
  font-size: 0.58rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-preview button,
.file-preview > button {
  display: grid;
  width: 1.9rem;
  height: 1.9rem;
  flex: 0 0 auto;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: #7b879c;
  background: transparent;
}

.reply-preview button:hover,
.file-preview > button:hover {
  background: rgba(52, 120, 246, 0.09);
}

.reply-preview button svg,
.file-preview > button svg {
  width: 0.85rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
}

.file-preview {
  border-right-color: #845fe0;
  background: #f4f0ff;
}

.file-type-icon {
  display: grid;
  width: 2.2rem;
  height: 2.2rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 9px;
  color: #7956d5;
  background: #e8dfff;
}

.file-type-icon svg {
  width: 1.05rem;
}

.file-preview > span:nth-child(2) {
  display: grid;
  min-width: 0;
  flex: 1;
}

.file-preview b {
  overflow: hidden;
  font-size: 0.61rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-preview small {
  color: #8c84a2;
  font-size: 0.52rem;
}

/* Info panel */

.info-panel {
  position: relative;
  z-index: 22;
  display: flex;
  width: 0;
  flex: 0 0 0;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  border-right: 0 solid var(--line);
  background: #fff;
  opacity: 0;
  transition: width 260ms var(--ease), flex-basis 260ms var(--ease), opacity 180ms ease;
}

.info-panel.open {
  width: 310px;
  flex-basis: 310px;
  border-right-width: 1px;
  opacity: 1;
}

.info-panel > * {
  width: 309px;
}

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

.info-panel > header h2 {
  margin: 0;
  font-size: 0.78rem;
}

.info-panel > header .icon-button svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
}

.profile-summary {
  padding: 1.7rem 1rem 1.2rem;
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.profile-summary > .avatar {
  width: 4.6rem;
  height: 4.6rem;
  margin: 0 auto 0.8rem;
  border-radius: 22px;
  font-size: 1.35rem;
  box-shadow: 0 12px 27px rgba(45, 103, 225, 0.19);
}

.profile-summary > .avatar .status-dot {
  right: 1px;
  bottom: 1px;
  width: 0.88rem;
  height: 0.88rem;
  border-width: 3px;
}

.profile-summary h3 {
  margin: 0;
  font-size: 0.88rem;
}

.profile-summary > p {
  margin: 0.15rem 0 1rem;
  color: var(--ink-faint);
  direction: ltr;
  font-size: 0.6rem;
}

.profile-actions {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
}

.profile-actions button {
  display: grid;
  gap: 0.35rem;
  place-items: center;
  border: 0;
  color: #7c879a;
  background: transparent;
  font-size: 0.54rem;
}

.profile-actions button > span {
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  border-radius: 12px;
  color: var(--cobalt-600);
  background: var(--cobalt-50);
  transition: 150ms ease;
}

.profile-actions button:hover > span {
  color: #fff;
  background: var(--cobalt-500);
  transform: translateY(-2px);
}

.profile-actions svg {
  width: 1rem;
}

.info-card {
  margin: 0.75rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 15px;
}

.info-card + .info-card {
  margin-top: 0;
}

.info-card > button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem;
  border: 0;
  border-radius: 11px;
  text-align: right;
  background: transparent;
}

.info-card > button:hover {
  background: var(--surface-soft);
}

.info-card > button + button {
  border-top: 1px solid var(--line);
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.info-card-icon {
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
}

.info-card-icon svg {
  width: 1rem;
  height: 1rem;
}

.image-icon {
  color: #3d8adb;
  background: #e9f4ff;
}

.link-icon {
  color: #31aa90;
  background: #e9faf6;
}

.star-icon {
  color: #e99d2c;
  background: #fff5df;
}

.danger-icon {
  color: var(--danger);
  background: #fff0f2;
}

.info-card > button > span:nth-child(2) {
  display: grid;
  min-width: 0;
  flex: 1;
}

.info-card b {
  font-size: 0.64rem;
}

.info-card small {
  color: var(--ink-faint);
  font-size: 0.53rem;
}

.info-card .chevron {
  width: 0.75rem;
  color: #a6afbd;
}

.info-card .danger-option b {
  color: var(--danger);
}

/* Global overlays */

.toast-region {
  position: fixed;
  z-index: 120;
  right: 1rem;
  bottom: 1rem;
  display: grid;
  gap: 0.5rem;
  width: min(calc(100vw - 2rem), 330px);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 13px;
  color: #fff;
  background: rgba(14, 27, 59, 0.94);
  box-shadow: var(--shadow-md);
  font-size: 0.68rem;
  backdrop-filter: blur(14px);
  animation: toast-in 250ms var(--ease);
  pointer-events: auto;
}

.toast.success {
  background: rgba(19, 116, 84, 0.95);
}

.toast.error {
  background: rgba(177, 49, 68, 0.95);
}

.toast > span {
  display: grid;
  width: 1.6rem;
  height: 1.6rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 7px;
  color: currentColor;
  background: rgba(255, 255, 255, 0.12);
}

.toast svg {
  width: 0.8rem;
  height: 0.8rem;
}

.toast.leaving {
  animation: toast-out 200ms ease forwards;
}

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

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(7px);
  }
}

.mobile-overlay {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: none;
  background: rgba(5, 13, 34, 0.48);
  opacity: 0;
  backdrop-filter: blur(3px);
  transition: 180ms ease;
}

.modal-backdrop {
  position: fixed;
  z-index: 150;
  inset: 0;
  display: grid;
  padding: 1rem;
  place-items: center;
  background: rgba(6, 13, 33, 0.52);
  backdrop-filter: blur(5px);
  animation: fade-in 180ms ease;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.confirm-dialog {
  width: min(100%, 360px);
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 22px;
  text-align: center;
  background: #fff;
  box-shadow: var(--shadow-lg);
  animation: dialog-in 220ms var(--ease);
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
}

.confirm-icon {
  display: grid;
  width: 3.2rem;
  height: 3.2rem;
  margin: 0 auto 0.85rem;
  place-items: center;
  border-radius: 16px;
  color: var(--danger);
  background: #fff0f2;
}

.confirm-icon svg {
  width: 1.35rem;
}

.confirm-dialog h2 {
  margin: 0;
  font-size: 1rem;
}

.confirm-dialog p {
  margin: 0.35rem 0 1.2rem;
  color: var(--ink-soft);
  font-size: 0.66rem;
  line-height: 1.8;
}

.confirm-dialog > div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.secondary-button,
.danger-button {
  height: 2.7rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
  font-size: 0.68rem;
  font-weight: 650;
}

.secondary-button:hover {
  background: #edf1f7;
}

.danger-button {
  border-color: var(--danger);
  color: #fff;
  background: var(--danger);
}

.danger-button:hover {
  background: #dc485f;
}

/* Dark theme */

.chat-page.dark {
  color-scheme: dark;
  --ink: #edf2ff;
  --ink-soft: #aab5cd;
  --ink-faint: #77839c;
  --line: #26314b;
  --surface: #151d31;
  --surface-soft: #1b253c;
  --surface-blue: #17284b;
  --cobalt-50: #1b2d50;
  --cobalt-100: #233c69;
  background: #0c1323;
}

.dark .messenger-shell,
.dark .sidebar,
.dark .sidebar-footer,
.dark .chat-header,
.dark .composer-area,
.dark .info-panel,
.dark .conversation-search-bar {
  background: rgba(19, 27, 45, 0.98);
}

.dark .chat-workspace,
.dark .messages-scroll {
  background: #101828;
}

.dark .current-user,
.dark .contact-search,
.dark .message-input-wrap {
  border-color: var(--line);
  background: #1b2539;
}

.dark .contact-item:hover {
  background: #1a2439;
}

.dark .contact-item.active {
  background: linear-gradient(135deg, #1d3155, #192b4d);
}

.dark .message-bubble {
  border-color: #2a354d;
  color: #d9e1f1;
  background: #1b2538;
}

.dark .outgoing .message-bubble {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(145deg, #3478ed, #2457c6);
}

.dark .status-dot {
  border-color: #151d31;
}

.dark .message-reaction,
.dark .message-actions,
.dark .emoji-picker,
.dark .confirm-dialog,
.dark .file-download {
  background: #1b2538;
}

.dark .message-reaction {
  border-color: #101828;
}

.dark .reply-quote {
  background: #202c43;
}

.dark .outgoing .reply-quote {
  background: rgba(255, 255, 255, 0.12);
}

.dark .composer-hint {
  color: #657087;
}

.dark .info-card,
.dark .demo-login,
.dark .local-test-panel,
.dark .local-users a {
  border-color: var(--line);
}

.dark .local-test-panel,
.dark .local-users a {
  background: var(--surface-soft);
}

.dark .messages-background {
  opacity: 0.25;
}

.dark .scroll-bottom {
  border-color: var(--line);
  background: #1b2538;
}

.dark .typing-bubble {
  border-color: var(--line);
  background: #1b2538;
}

.dark .reply-preview {
  background: #1c2d4d;
}

.dark .file-preview {
  background: #292240;
}

/* Responsive */

@media (min-width: 1500px) {
  .sidebar {
    width: 370px;
    flex-basis: 370px;
  }

  .messages-background {
    left: 370px;
  }
}

@media (max-width: 1120px) {
  .login-shell {
    grid-template-columns: minmax(390px, 0.92fr) minmax(420px, 1.08fr);
  }

  .showcase-art {
    right: 40%;
    width: min(51vw, 530px);
  }

  .note-one {
    display: none;
  }

  .sidebar {
    width: 310px;
    min-width: 280px;
    flex-basis: 310px;
  }

  .messages-background {
    left: 310px;
  }

  .info-panel.open {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 310px;
    box-shadow: -20px 0 45px rgba(20, 32, 68, 0.15);
  }
}

@media (max-width: 860px) {
  .login-shell {
    display: block;
  }

  .login-showcase {
    display: none;
  }

  .auth-panel {
    min-height: 100dvh;
    padding: 3rem 1.3rem 5rem;
    background:
      radial-gradient(circle at 10% 3%, rgba(64, 131, 255, 0.12), transparent 18rem),
      #f9fbff;
    box-shadow: none;
  }

  .mobile-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 3rem;
  }

  .mobile-brand span {
    display: grid;
    line-height: 1.3;
  }

  .mobile-brand b {
    font-size: 1.05rem;
  }

  .mobile-brand small {
    color: var(--ink-faint);
    font-size: 0.62rem;
  }

  .sidebar {
    position: fixed;
    z-index: 30;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(88vw, 340px);
    min-width: 0;
    transform: translateX(105%);
    transition: transform 240ms var(--ease);
  }

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

  .mobile-close {
    display: grid;
    margin-inline-start: auto;
  }

  .sidebar-header .subtle-button {
    display: none;
  }

  .mobile-overlay {
    display: block;
    pointer-events: none;
  }

  .mobile-overlay.visible {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-menu {
    display: grid;
  }

  .mobile-menu svg {
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 1.8;
  }

  .messages-background {
    left: 0;
  }

  .info-panel.open {
    position: fixed;
    z-index: 35;
    top: 0;
    right: auto;
    bottom: 0;
    left: 0;
    width: min(88vw, 310px);
    flex-basis: 0;
    box-shadow: 20px 0 50px rgba(6, 18, 47, 0.2);
  }

  .message-wrap {
    max-width: min(78%, 520px);
  }
}

@media (max-width: 560px) {
  .auth-heading {
    align-items: flex-start;
  }

  .auth-footer {
    right: 1.3rem;
    left: 1.3rem;
  }

  .chat-header {
    height: 68px;
    flex-basis: 68px;
    padding: 0 0.7rem;
  }

  .chat-person {
    gap: 0.5rem;
  }

  .chat-person .avatar {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 12px;
    font-size: 0.74rem;
  }

  .chat-person h1 {
    max-width: 31vw;
    font-size: 0.75rem;
  }

  .desktop-action,
  .header-separator {
    display: none;
  }

  .chat-actions .icon-button,
  .mobile-menu {
    width: 2.2rem;
    height: 2.2rem;
  }

  .conversation-search-bar {
    top: 68px;
  }

  .messages-background {
    inset: 68px 0 76px;
  }

  .messages-list {
    padding: 1rem 0.7rem;
  }

  .message-wrap {
    max-width: 84%;
  }

  .message-row .message-avatar {
    display: none;
  }

  .message-bubble {
    padding: 0.55rem 0.67rem 0.37rem;
  }

  .message-bubble p {
    font-size: 0.68rem;
  }

  .message-actions {
    display: none;
  }

  .file-bubble {
    min-width: min(62vw, 220px);
  }

  .typing-row {
    bottom: 78px;
  }

  .composer-area {
    padding: 0.52rem 0.5rem;
  }

  .composer {
    gap: 0.22rem;
  }

  .composer > label.composer-icon {
    width: 2.25rem;
  }

  .message-input-wrap {
    min-height: 2.8rem;
    border-radius: 14px;
  }

  .message-input-wrap textarea {
    min-height: 2.72rem;
    padding: 0.76rem 0.7rem 0.5rem 0.1rem;
  }

  .emoji-button {
    width: 2.2rem;
  }

  .voice-button,
  .send-button {
    width: 2.8rem;
    height: 2.8rem;
  }

  .composer-hint {
    display: none;
  }

  .emoji-picker {
    right: 0.5rem;
    bottom: calc(100% + 0.35rem);
    width: calc(100vw - 1rem);
  }

  .emoji-picker > div {
    grid-template-columns: repeat(8, 1fr);
  }

  .reply-preview,
  .file-preview {
    margin-bottom: 0.38rem;
  }

  .scroll-bottom {
    bottom: 0.45rem;
  }
}

@media (max-height: 720px) and (min-width: 861px) {
  .showcase-copy {
    margin-top: 2.8rem;
  }

  .showcase-art {
    width: min(39vw, 460px);
  }

  .auth-heading {
    margin-bottom: 1.4rem;
  }

  .auth-form {
    gap: 0.85rem;
  }

  .signup-line {
    display: none;
  }

  .local-test-panel {
    margin-top: 0.6rem;
  }
}

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