/* ==========================================================================
   Луч — AURA: пространственный стеклянный интерфейс.
   Полупрозрачные слои, ambient-свет, орбы, мягкие свечения.
   ========================================================================== */

:root {
  --bg: #06080f;
  --text: #eaf0ff;
  --muted: #8e9ab8;
  --faint: #64708c;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --glass: rgba(255, 255, 255, 0.055);
  --glass-2: rgba(255, 255, 255, 0.085);
  --violet: #8b7bff;
  --blue: #4d9cff;
  --cyan: #4de3c1;
  --pink: #ff7ad9;
  --danger: #ff6b8a;
  --online: #4de3c1;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 8px 26px rgba(0, 0, 0, 0.35);
  --sans: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  color-scheme: dark;
}

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(900px 600px at 12% -10%, rgba(124, 92, 255, 0.38), transparent 60%),
    radial-gradient(820px 520px at 92% 12%, rgba(77, 227, 193, 0.16), transparent 62%),
    radial-gradient(900px 700px at 62% 115%, rgba(255, 122, 217, 0.16), transparent 62%),
    var(--bg);
}

[hidden] {
  display: none !important;
}

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

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

::selection {
  background: rgba(139, 123, 255, 0.4);
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* ------------------------------------------------------------- базовое стекло */

.glass,
.sidebar,
.chat,
.rail,
.modal__card,
.search-overlay__panel,
.auth__card {
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(26px) saturate(150%);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.09);
}

/* -------------------------------------------------------------------- каркас */

.app {
  display: grid;
  grid-template-columns: 72px 300px minmax(0, 1fr);
  gap: 14px;
  height: 100dvh;
  padding: 14px;
}

.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 0 12px;
  border-radius: 24px;
}

.rail__logo {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 700;
  color: #06121a;
  background: conic-gradient(from 210deg, var(--violet), var(--cyan), var(--pink), var(--violet));
  box-shadow: 0 0 24px rgba(139, 123, 255, 0.45);
}

.rail__line {
  width: 1px;
  flex: 0 0 26px;
  background: linear-gradient(var(--line-strong), transparent);
  margin-bottom: 2px;
}

.rail__btn {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: background 0.14s var(--ease), color 0.14s var(--ease);
}

.rail__btn svg {
  width: 19px;
  height: 19px;
}

.rail__btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.rail__btn.is-active {
  color: #fff;
  background: rgba(139, 123, 255, 0.18);
  box-shadow: inset 0 0 0 1px rgba(139, 123, 255, 0.35);
}

.rail__btn.is-on {
  color: var(--cyan);
}

.rail__badge {
  position: absolute;
  top: -1px;
  right: -1px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--cyan);
  color: #04211c;
  font-size: 9px;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: 0 0 10px rgba(77, 227, 193, 0.4);
}

.rail__bell-dot {
  position: absolute;
  right: 7px;
  top: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
}

.rail__btn.is-on .rail__bell-dot {
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}

.rail__spacer {
  flex: 1;
}

.rail__status {
  display: grid;
  justify-items: center;
  gap: 3px;
  width: 46px;
  padding: 7px 0 6px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.rail__status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
}

.rail__status.is-off .rail__status-dot {
  background: var(--faint);
  box-shadow: none;
}

.rail__status-text {
  font-size: 8.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.rail__stat {
  display: grid;
  justify-items: center;
  gap: 1px;
  color: var(--muted);
  padding: 4px 0;
  width: 46px;
}

.rail__stat svg {
  width: 16px;
  height: 16px;
  opacity: 0.75;
}

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

.rail__ver {
  font-size: 8px;
  letter-spacing: 0.14em;
  color: var(--faint);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  height: 44px;
  margin-top: 2px;
}

/* ---------------------------------------------------------------- sidebar */

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-radius: 24px;
  overflow: hidden;
  background:
    radial-gradient(420px 220px at 10% -20%, rgba(139, 123, 255, 0.13), transparent 70%),
    var(--glass);
}

.sidebar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 12px 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.logo {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 700;
  color: #06121a;
  background: conic-gradient(from 210deg, var(--violet), var(--cyan), var(--pink), var(--violet));
  box-shadow: 0 0 22px rgba(139, 123, 255, 0.35);
}

.logo--lg {
  width: 46px;
  height: 46px;
  font-size: 20px;
}

.brand__name {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.brand__me {
  flex: none;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.sidebar__tools {
  display: flex;
  gap: 2px;
  flex: none;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  color: var(--muted);
  transition: background 0.14s var(--ease), color 0.14s var(--ease);
}

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

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

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

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

.icon-btn.is-on {
  color: var(--cyan);
  background: rgba(77, 227, 193, 0.12);
}

.search {
  position: relative;
  margin: 10px 16px 6px;
}

.search__input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  font-size: 13px;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.search__input::-webkit-search-cancel-button {
  appearance: none;
}

.search__input::placeholder {
  color: var(--faint);
}

.search__input:focus {
  outline: none;
  border-color: rgba(139, 123, 255, 0.4);
  background: rgba(255, 255, 255, 0.06);
}

.chat-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 8px 14px;
  overscroll-behavior: contain;
}

.hint {
  margin: 10px 6px;
  padding: 10px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.section-title {
  padding: 14px 8px 6px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--faint);
}

.chat-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 8px;
  border-radius: 16px;
  text-align: left;
  color: inherit;
  position: relative;
  transition: background 0.14s var(--ease);
}

.chat-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.chat-item.is-active {
  background: linear-gradient(100deg, rgba(139, 123, 255, 0.22), rgba(77, 156, 255, 0.06));
  box-shadow: inset 0 0 0 1px rgba(139, 123, 255, 0.28);
}

.chat-item__body {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.chat-item__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.chat-item__name {
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item__time {
  flex: none;
  color: var(--faint);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

.chat-item__preview {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
}

.chat-item__preview span:not(.chat-item__author) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item__author {
  flex: none;
  color: var(--cyan);
  white-space: nowrap;
  opacity: 0.9;
}

.badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--cyan);
  color: #04211c;
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
}

.chat-item__aside {
  display: grid;
  justify-items: end;
  gap: 6px;
}

/* ------------------------------------------------------------------ орбы */

.avatar {
  --c: #7c6cff;
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 24%, color-mix(in srgb, var(--c) 45%, #ffffff), var(--c) 72%);
  color: #071019;
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  user-select: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.avatar--sm {
  width: 28px;
  height: 28px;
  font-size: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.avatar--ghost {
  background: none;
  box-shadow: none;
}

.avatar__dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--online);
  border: 2px solid #0a0e18;
  box-shadow: 0 0 8px rgba(77, 227, 193, 0.6);
}

/* --------------------------------------------------------------------- чат */

.chat {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-radius: 26px;
  overflow: hidden;
  background:
    radial-gradient(700px 360px at 88% -8%, rgba(139, 123, 255, 0.14), transparent 62%),
    radial-gradient(520px 320px at 6% 108%, rgba(77, 227, 193, 0.08), transparent 60%),
    var(--glass);
}

.chat__view {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.chat__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
  flex: none;
}

.chat__head .avatar {
  width: 44px;
  height: 44px;
  font-size: 13px;
  box-shadow: 0 0 0 3px rgba(139, 123, 255, 0.12), 0 0 26px rgba(139, 123, 255, 0.3);
}

.chat__title-wrap {
  min-width: 0;
  flex: 1;
}

.chat__title {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat__status {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat__status b {
  color: var(--cyan);
  font-weight: 600;
}

.chat__status .is-online {
  color: var(--online);
}

.chat__right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.sync {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(77, 227, 193, 0.25);
  background: rgba(77, 227, 193, 0.07);
  color: var(--cyan);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sync i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}

.sync.is-off {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: var(--faint);
}

.sync.is-off i {
  background: var(--faint);
  box-shadow: none;
}

.chat__back {
  display: none;
  margin-left: -6px;
}

.chat__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 22px 8px;
  display: flex;
  flex-direction: column;
  overscroll-behavior: contain;
}

.chat__body::before {
  content: '';
  margin-top: auto;
}

.day {
  align-self: center;
  margin: 18px 0 4px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.msg {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  margin-top: 12px;
  max-width: min(74%, 660px);
}

.msg--own {
  margin-left: auto;
  flex-direction: row-reverse;
}

.msg.is-cont {
  margin-top: 4px;
}

.msg__col {
  min-width: 0;
  display: grid;
  justify-items: start;
}

.msg--own .msg__col {
  justify-items: end;
}

.msg__author {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan);
  margin: 0 0 4px 6px;
}

.bubble {
  position: relative;
  padding: 10px 14px 8px;
  border-radius: 18px 18px 18px 6px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  max-width: 100%;
}

.msg--own .bubble {
  border-radius: 18px 18px 6px 18px;
  background: linear-gradient(135deg, rgba(139, 123, 255, 0.95), rgba(77, 156, 255, 0.9));
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
  box-shadow: 0 10px 32px rgba(110, 92, 255, 0.35);
}

.msg__text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.5;
}

.msg__text a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.msg__meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 5px;
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.msg--own .msg__meta {
  color: rgba(255, 255, 255, 0.62);
}

.ticks {
  font-size: 11px;
  letter-spacing: -2px;
  color: rgba(255, 255, 255, 0.55);
}

.ticks.is-read {
  color: #b9fff0;
}

.quote {
  display: block;
  width: 100%;
  text-align: left;
  margin: 0 0 7px;
  padding: 6px 10px;
  border: none;
  border-left: 2px solid var(--cyan);
  border-radius: 9px;
  background: rgba(77, 227, 193, 0.08);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.quote b {
  display: block;
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 2px;
}

.msg--own .quote {
  border-left-color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.13);
  color: rgba(255, 255, 255, 0.85);
}

.msg--own .quote b {
  color: #fff;
}

.quote span {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.msg__actions {
  position: absolute;
  top: -14px;
  right: 8px;
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  background: rgba(14, 18, 30, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 0.13s var(--ease), transform 0.13s var(--ease);
  pointer-events: none;
  backdrop-filter: blur(12px);
}

.msg--own .msg__actions {
  right: auto;
  left: 8px;
}

.msg:hover .msg__actions,
.msg:focus-within .msg__actions {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.msg__actions button {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 8px;
  color: var(--muted);
}

.msg__actions button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.msg__actions svg {
  width: 13px;
  height: 13px;
}

.msg.flash .bubble {
  animation: flash 1.1s var(--ease);
}

@keyframes flash {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(77, 227, 193, 0);
  }
  30% {
    box-shadow: 0 0 0 3px rgba(77, 227, 193, 0.45);
  }
}

/* ---------------------------------------------------------------- composer */

.composer {
  position: relative;
  flex: none;
  padding: 10px 22px max(16px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.015);
}

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

.composer__side {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.composer__tool {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: background 0.14s var(--ease), color 0.14s var(--ease), border-color 0.14s var(--ease);
}

.composer__tool svg {
  width: 18px;
  height: 18px;
}

.composer__tool:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
}

.composer__tool.is-on {
  color: var(--cyan);
  border-color: rgba(77, 227, 193, 0.35);
}

.composer__box {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.composer__box:focus-within {
  border-color: rgba(139, 123, 255, 0.45);
}

.composer__input {
  flex: 1;
  width: 100%;
  min-height: 24px;
  max-height: 160px;
  padding: 10px 0;
  border: none;
  background: none;
  color: var(--text);
  resize: none;
  outline: none;
  line-height: 1.45;
  font-size: 14px;
}

.composer__input::placeholder {
  color: var(--faint);
}

/* Многострочное сообщение: инструменты остаются у верхней кромки. */
.composer__row.is-expanded .composer__side {
  align-self: flex-start;
  margin-top: 5px;
}

.composer__row.is-expanded .send-btn {
  align-self: flex-end;
}

.send-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--violet), var(--cyan));
  color: #06121a;
  box-shadow: 0 0 22px rgba(77, 227, 193, 0.4);
  transition: transform 0.12s var(--ease), filter 0.15s var(--ease);
}

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

.send-btn:hover {
  filter: brightness(1.08);
}

.send-btn:active {
  transform: scale(0.95);
}

.composer__hint {
  margin: 7px 6px 0;
  color: var(--faint);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}

.composer:focus-within .composer__hint {
  opacity: 1;
}

.emoji-pop {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  z-index: 30;
  width: min(330px, calc(100vw - 32px));
  padding: 8px;
  border-radius: 18px;
  background: rgba(14, 18, 30, 0.96);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
}

.emoji-pop button {
  font-size: 19px;
  line-height: 1;
  padding: 7px 0;
  border-radius: 9px;
}

.emoji-pop button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.reply-bar,
.edit-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 7px 8px 7px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-left: 2px solid var(--cyan);
}

.edit-bar {
  border-left-color: var(--violet);
}

.reply-bar__body,
.edit-bar__body {
  flex: 1;
  min-width: 0;
  display: grid;
  font-size: 12px;
}

.reply-bar__body b,
.edit-bar__body b {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cyan);
}

.edit-bar__body b {
  color: var(--violet);
}

.reply-bar__body span,
.edit-bar__body span {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --------------------------------------------------------------- вложения */

.msg--media .bubble {
  padding: 6px 6px 8px;
}

.msg--media .msg__text {
  padding: 4px 8px 0;
}

.msg--media .msg__meta {
  padding: 0 8px;
}

.att-grid {
  display: grid;
  gap: 3px;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 3px;
}

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

.att-grid--2,
.att-grid--3,
.att-grid--4 {
  grid-template-columns: 1fr 1fr;
}

.att-grid--3 .att-img:first-child {
  grid-row: span 2;
}

.att-img {
  display: block;
  border: 0;
  padding: 0;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
  line-height: 0;
}

.att-img img {
  display: block;
  width: 100%;
  max-height: 340px;
  object-fit: cover;
}

.att-grid--1 .att-img img {
  width: auto;
  max-width: 100%;
  margin: 0 auto;
  object-fit: contain;
}

.att-grid--2 .att-img,
.att-grid--3 .att-img,
.att-grid--4 .att-img {
  aspect-ratio: 1;
}

.att-grid--2 .att-img img,
.att-grid--3 .att-img img,
.att-grid--4 .att-img img {
  height: 100%;
}

.file-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  margin: 3px 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: inherit;
  text-decoration: none;
}

.msg--own .file-chip {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.2);
}

.file-chip__icon svg {
  width: 20px;
  height: 20px;
  color: var(--cyan);
}

.file-chip__body {
  display: grid;
  min-width: 0;
  flex: 1;
}

.file-chip__body b {
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-chip__body span {
  font-size: 10px;
  color: var(--muted);
}

.msg--own .file-chip__body span {
  color: rgba(255, 255, 255, 0.7);
}

.file-chip__download svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

.msg__text--deleted {
  color: var(--muted);
  font-style: italic;
}

.msg--deleted .bubble {
  opacity: 0.7;
  border-style: dashed;
}

.msg__edited {
  margin-right: 6px;
  font-size: 8.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.8;
}

.pending {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.pending__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 240px;
  padding: 5px 28px 5px 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.pending__item img {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  object-fit: cover;
}

.pending__file svg {
  width: 24px;
  height: 24px;
  color: var(--muted);
}

.pending__name {
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pending__spinner {
  width: 13px;
  height: 13px;
  flex: none;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--cyan);
  animation: spin 0.8s linear infinite;
}

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

.pending__remove {
  position: absolute;
  right: 3px;
  top: 3px;
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--muted);
}

.pending__remove svg {
  width: 10px;
  height: 10px;
}

/* ------------------------------------------------------------ пустой экран */

.empty {
  margin: auto;
  text-align: center;
  max-width: 380px;
  padding: 30px;
}

.empty h2 {
  margin: 22px 0 8px;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.empty p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
}

.empty__art {
  position: relative;
  width: 190px;
  height: 110px;
  margin: 0 auto;
}

.empty__bubble {
  position: absolute;
  border-radius: 50%;
  filter: blur(0.5px);
}

.empty__bubble--1 {
  width: 74px;
  height: 74px;
  left: 18px;
  top: 8px;
  background: radial-gradient(circle at 32% 28%, rgba(184, 172, 255, 0.95), rgba(139, 123, 255, 0.9) 55%, rgba(77, 156, 255, 0.85));
  box-shadow: 0 0 40px rgba(139, 123, 255, 0.45);
}

.empty__bubble--2 {
  width: 44px;
  height: 44px;
  right: 32px;
  top: 42px;
  background: radial-gradient(circle at 32% 28%, #b9fff0, #4de3c1 70%);
  box-shadow: 0 0 30px rgba(77, 227, 193, 0.4);
}

.empty__bubble--3 {
  width: 14px;
  height: 14px;
  right: 14px;
  top: 10px;
  background: rgba(255, 255, 255, 0.12);
}

.empty__pulse {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 32px;
  color: var(--cyan);
  opacity: 0.55;
}

/* ---------------------------------------------------------------- модалки */

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(4, 6, 12, 0.6);
  backdrop-filter: blur(8px);
  animation: fade 0.15s var(--ease);
}

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

.modal__card {
  width: min(440px, 100%);
  max-height: min(80dvh, 700px);
  display: flex;
  flex-direction: column;
  padding: 22px;
  border-radius: 24px;
  animation: pop 0.18s var(--ease);
}

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

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

.modal__title {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
}

.modal__sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.modal__body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  display: grid;
  gap: 4px;
}

.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.modal__card--sm {
  width: min(380px, 100%);
}

.modal__text {
  margin: 0 0 18px;
  font-size: 14.5px;
  line-height: 1.55;
}

.person {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 7px 8px;
  border-radius: 14px;
  border: 1px solid transparent;
  text-align: left;
  width: 100%;
}

.person:hover {
  background: rgba(255, 255, 255, 0.05);
}

.person.is-picked {
  border-color: rgba(139, 123, 255, 0.5);
  background: rgba(139, 123, 255, 0.12);
}

.person__body {
  min-width: 0;
  flex: 1;
}

.person__name {
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.person .avatar {
  width: 36px;
  height: 36px;
  font-size: 11px;
}

.check {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1.5px solid var(--line-strong);
  display: grid;
  place-items: center;
  flex: none;
  color: transparent;
}

.person.is-picked .check {
  background: var(--violet);
  border-color: var(--violet);
  color: #fff;
}

.check svg {
  width: 12px;
  height: 12px;
}

/* ------------------------------------------------------------------ кнопки */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}

.btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn--primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--violet), var(--blue));
  color: #fff;
  box-shadow: 0 10px 28px rgba(110, 92, 255, 0.35);
}

.btn--primary:hover {
  filter: brightness(1.08);
}

.btn--ghost {
  background: transparent;
}

.btn--danger {
  background: linear-gradient(135deg, #ff6b8a, #ff4d6d);
  border-color: transparent;
  color: #fff;
}

.btn--wide {
  width: 100%;
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
}

/* ------------------------------------------------------------------ поиск */

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: start center;
  padding: 8vh 16px 16px;
  background: rgba(4, 6, 12, 0.55);
  backdrop-filter: blur(10px);
  animation: fade 0.15s var(--ease);
}

.search-overlay__panel {
  width: min(620px, 100%);
  max-height: 72vh;
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  overflow: hidden;
  animation: pop 0.18s var(--ease);
}

.search-overlay__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.search-overlay__head > svg {
  width: 17px;
  height: 17px;
  color: var(--faint);
  flex: none;
}

.search-overlay__input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  outline: none;
  font-size: 14px;
}

.search-overlay__input::placeholder {
  color: var(--faint);
}

.search-overlay__results {
  overflow-y: auto;
  padding: 6px;
  min-height: 110px;
}

.search-hit {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  text-align: left;
}

.search-hit:hover {
  background: rgba(255, 255, 255, 0.06);
}

.search-hit__top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
}

.search-hit__top b {
  font-weight: 600;
}

.search-hit__top span {
  color: var(--faint);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  flex: none;
}

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

.search-overlay .hint {
  margin: 12px;
}

/* ------------------------------------------------------------------ тосты */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 100;
  display: grid;
  gap: 8px;
  justify-items: center;
  pointer-events: none;
  width: min(420px, calc(100vw - 28px));
}

.toast {
  padding: 9px 15px;
  border-radius: 12px;
  background: rgba(16, 20, 32, 0.94);
  border: 1px solid var(--line);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  font-size: 12.5px;
  backdrop-filter: blur(14px);
  animation: toast-in 0.18s var(--ease);
}

.toast--error {
  border-color: rgba(255, 107, 138, 0.45);
  color: #ffc2cd;
}

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

/* ---------------------------------------------------------------- лайтбокс */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 26px;
  background: rgba(3, 5, 10, 0.9);
  backdrop-filter: blur(10px);
  animation: fade 0.15s var(--ease);
}

.lightbox img {
  max-width: 100%;
  max-height: 88vh;
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}

.lightbox__close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.lightbox__close svg {
  width: 18px;
  height: 18px;
}

/* ------------------------------------------------------------- перетаскивание */

.chat__body.is-dragging {
  outline: 2px dashed rgba(77, 227, 193, 0.6);
  outline-offset: -10px;
  border-radius: 18px;
}

/* --------------------------------------------------------------------- вход */

.auth {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: grid;
  place-content: center;
  gap: 18px;
  padding: 28px 18px;
}

.auth__card {
  position: relative;
  width: min(420px, 100%);
  padding: 30px;
  border-radius: 28px;
}

.auth__head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.auth__title {
  margin: 0;
  font-size: 24px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.auth__subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.tabs {
  display: flex;
  gap: 22px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.tabs__btn {
  padding: 9px 0;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

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

.tabs__btn.is-active {
  color: var(--text);
  border-bottom-color: var(--violet);
}

.auth__form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field__label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.field__hint {
  color: var(--faint);
  font-size: 10.5px;
  line-height: 1.4;
}

.input {
  width: 100%;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

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

.input:focus {
  outline: none;
  border-color: rgba(139, 123, 255, 0.55);
  background: rgba(255, 255, 255, 0.07);
}

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

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

.password-toggle {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--faint);
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}

.password-toggle:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.password-toggle:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 1px;
}

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

.password-toggle .eye-off {
  display: none;
}

.password-toggle.is-visible {
  color: var(--cyan);
}

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

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

.verify {
  display: grid;
  gap: 10px;
}

.verify__lead {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.verify__lead b {
  color: var(--text);
}

.verify__hint {
  margin: 2px 0 0;
  text-align: center;
  color: var(--faint);
  font-size: 11px;
}

.danger-zone {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 107, 138, 0.25);
  display: grid;
  gap: 8px;
}

.danger-zone h4 {
  margin: 0;
  font-size: 13px;
  color: #ffb3c2;
}

.danger-zone p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.danger-zone .btn {
  justify-self: start;
}

.auth__error {
  margin: 0;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 107, 138, 0.4);
  background: rgba(255, 107, 138, 0.1);
  color: #ffb3c2;
  font-size: 12.5px;
}

.auth__demo {
  margin-top: 16px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 9px;
  border-radius: 12px;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  font-size: 12px;
}

.auth__demo b {
  color: var(--text);
}

.auth__demo:hover {
  color: var(--text);
  border-color: rgba(139, 123, 255, 0.5);
}

.auth__demo-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--online);
  box-shadow: 0 0 8px var(--online);
}

.auth__foot {
  text-align: center;
  color: var(--faint);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0;
}

/* -------------------------------------------------------------- скроллбары */

.chat-list,
.chat__body,
.modal__body,
.search-overlay__results {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.chat-list::-webkit-scrollbar,
.chat__body::-webkit-scrollbar,
.modal__body::-webkit-scrollbar,
.search-overlay__results::-webkit-scrollbar {
  width: 8px;
}

.chat-list::-webkit-scrollbar-thumb,
.chat__body::-webkit-scrollbar-thumb,
.modal__body::-webkit-scrollbar-thumb,
.search-overlay__results::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* ---------------------------------------------------------------- адаптив */

@media (min-width: 1001px) {
  .sidebar__tools {
    display: none;
  }
}

@media (max-width: 1000px) {
  .app {
    grid-template-columns: 0 300px minmax(0, 1fr);
  }

  .rail {
    display: none;
  }
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0;
  }

  .sidebar {
    border-radius: 0;
    border: none;
    height: 100dvh;
    backdrop-filter: none;
    background: transparent;
    box-shadow: none;
  }

  .chat {
    display: none;
    border-radius: 0;
    border: none;
  }

  .app.is-open .sidebar {
    display: none;
  }

  .app.is-open .chat {
    display: flex;
    position: absolute;
    inset: 0;
    z-index: 5;
  }

  .chat__back {
    display: grid;
  }

  .chat__body {
    padding: 12px 14px 8px;
  }

  .msg {
    max-width: 88%;
  }

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

  .composer__row {
    gap: 6px;
  }

  .composer__tool {
    width: 36px;
    height: 36px;
  }

  .composer__box {
    min-height: 46px;
    padding: 4px 12px;
  }

  .send-btn {
    width: 42px;
    height: 42px;
  }

  .composer__hint {
    display: none;
  }

  .chat__head {
    padding: 12px 14px;
  }

  .sync {
    display: none;
  }
}

@media (max-width: 420px) {
  .brand__me {
    max-width: 84px;
    font-size: 10.5px;
  }

  .brand__name {
    font-size: 14.5px;
  }

  .chat-item {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 9px;
  }

  .chat-item .avatar {
    width: 40px;
    height: 40px;
  }
}

/* ------------------------------------------------------------------- звонки */

.call {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
}

.call__card {
  width: 300px;
  padding: 22px 20px 20px;
  border-radius: 24px;
  display: grid;
  justify-items: center;
  gap: 3px;
  background: rgba(12, 16, 26, 0.96);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  animation: call-in 0.18s var(--ease);
}

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

.call__avatar .avatar {
  width: 72px;
  height: 72px;
  font-size: 20px;
  margin-bottom: 10px;
  box-shadow: 0 0 0 4px rgba(139, 123, 255, 0.1), 0 0 30px rgba(139, 123, 255, 0.25);
}

.call__name {
  font-size: 17px;
  font-weight: 650;
  text-align: center;
}

.call__status {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 14px;
  font-variant-numeric: tabular-nums;
}

.call__actions {
  display: flex;
  gap: 12px;
}

.call__btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  transition: transform 0.12s var(--ease), background 0.15s var(--ease);
}

.call__btn:hover {
  background: rgba(255, 255, 255, 0.13);
}

.call__btn:active {
  transform: scale(0.95);
}

.call__btn svg {
  width: 22px;
  height: 22px;
}

.call__btn--accept {
  background: linear-gradient(140deg, #6ef0c8, #3ddc97);
  border-color: transparent;
  color: #04211a;
}

.call__btn--decline,
.call__btn--end {
  background: linear-gradient(140deg, #ff6b8a, #ff4d6d);
  border-color: transparent;
  color: #fff;
}

.call__btn--mute.is-on {
  background: rgba(255, 209, 102, 0.18);
  border-color: rgba(255, 209, 102, 0.45);
  color: #ffd166;
}

@media (max-width: 900px) {
  .call {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .call__card {
    width: auto;
  }
}
