:root {
  --accent: #2aabee;
  --accent-strong: #168bd2;
  --accent-soft: #e5f3fd;
  --accent-pale: #f0f8fe;
  --ink: #111827;
  --ink-soft: #344054;
  --muted: #7d899c;
  --line: #e5eaf0;
  --line-strong: #d6dde7;
  --surface: #ffffff;
  --chat-bg: #eef5fb;
  --incoming: #ffffff;
  --outgoing: #dff1fd;
  --success: #29b86f;
  --danger: #ef4444;
  --danger-soft: #fff0f1;
  --shadow-float: 0 18px 55px rgb(35 59 84 / 15%), 0 2px 10px rgb(35 59 84 / 8%);
  --shadow-modal: 0 24px 80px rgb(15 23 42 / 20%);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --app-height: 100dvh;
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, Arial, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--chat-bg);
  color: var(--ink);
}

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

button,
input,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:not(:disabled) {
  cursor: pointer;
}

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

button,
input,
textarea {
  outline: none;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  box-shadow: 0 0 0 3px rgb(42 171 238 / 22%);
}

svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

.shell {
  position: relative;
  width: 100%;
  height: 100dvh;
  min-height: 0;
}

.primary,
.secondary,
.small-button,
.text-button,
.danger-button {
  border: 0;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 650;
  line-height: 1;
  transition: transform .16s ease, background-color .16s ease, color .16s ease, opacity .16s ease;
}

.primary {
  min-height: 46px;
  padding: 0 20px;
  color: #fff;
  background: var(--accent);
}

.primary:hover {
  background: var(--accent-strong);
}

.primary:active,
.secondary:active,
.small-button:active,
.icon-button:active {
  transform: scale(.96);
}

.secondary {
  min-height: 44px;
  padding: 0 18px;
  background: #eef2f6;
  color: var(--ink-soft);
}

.small-button {
  min-height: 36px;
  padding: 0 13px;
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.small-button svg {
  width: 17px;
  height: 17px;
}

.text-button {
  min-height: 34px;
  padding: 0 8px;
  color: var(--accent-strong);
  background: transparent;
}

.danger-button {
  min-height: 40px;
  padding: 0 14px;
  color: var(--danger);
  background: var(--danger-soft);
}

.icon-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #52637a;
  background: transparent;
  transition: transform .16s ease, color .16s ease, background-color .16s ease;
}

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

.icon-button.light {
  color: #fff;
  background: rgb(0 0 0 / 20%);
}

.brand-mark {
  display: inline-grid;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  font-size: 16px;
  font-weight: 760;
  letter-spacing: -.04em;
}

.brand-mark.large {
  width: 86px;
  height: 86px;
  font-size: 27px;
  box-shadow: 0 12px 30px rgb(42 171 238 / 24%);
}

.brand-mark.small {
  width: 44px;
  height: 44px;
  flex-basis: 44px;
  font-size: 14px;
}

.login {
  display: grid;
  min-height: 100%;
  grid-template-columns: minmax(420px, 1fr) minmax(420px, .92fr);
  background: var(--surface);
}

.login-visual {
  position: relative;
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  overflow: hidden;
  color: var(--ink);
  background: var(--chat-bg);
}

.login-visual::before,
.login-visual::after {
  content: "";
  position: absolute;
  width: 320px;
  height: 320px;
  border: 1px solid rgb(42 171 238 / 16%);
  border-radius: 50%;
}

.login-visual::before {
  top: -180px;
  left: -120px;
}

.login-visual::after {
  right: -150px;
  bottom: -170px;
}

.login-visual h1 {
  margin: 26px 0 4px;
  font-size: clamp(42px, 5vw, 68px);
  line-height: .95;
  letter-spacing: -.055em;
}

.login-visual > p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 18px;
}

.login-message {
  position: absolute;
  max-width: 230px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 18px 18px 18px 5px;
  background: #fff;
  box-shadow: 0 10px 30px rgb(53 76 104 / 9%);
  font-size: 15px;
}

.login-message.one {
  left: 9%;
  bottom: 19%;
  transform: rotate(-3deg);
}

.login-message.two {
  top: 17%;
  right: 8%;
  border-color: #bfe3fa;
  border-radius: 18px 18px 5px;
  background: var(--outgoing);
  transform: rotate(2deg);
}

.login-message span {
  color: var(--accent-strong);
  font-size: 12px;
}

.login-form {
  width: min(430px, calc(100% - 64px));
  margin: auto;
  padding: 56px 0;
}

.mobile-login-brand {
  display: none;
}

.login-form h2 {
  margin: 0;
  font-size: 31px;
  letter-spacing: -.03em;
}

.form-subtitle {
  max-width: 360px;
  margin: 10px 0 30px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.login-form label,
.modal-card > label {
  display: grid;
  gap: 8px;
  margin-bottom: 17px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 620;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: #fff;
  font-size: 16px;
  font-weight: 430;
  transition: border-color .16s ease, box-shadow .16s ease;
}

input {
  height: 48px;
  padding: 0 14px;
}

textarea {
  min-height: 84px;
  padding: 12px 14px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #a5aebb;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(42 171 238 / 13%);
}

.login-form .primary {
  width: 100%;
  margin-top: 3px;
}

.hint,
.error,
.notification-help {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.error {
  min-height: 18px;
  color: var(--danger);
}

.app {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 0;
  grid-template-columns: 368px minmax(0, 1fr);
  background: var(--chat-bg);
}

.sidebar {
  position: relative;
  z-index: 3;
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.sidebar-head {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 15px 10px 20px;
}

.current-profile {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  text-align: left;
  background: transparent;
}

.current-profile > span:last-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.current-profile strong {
  font-size: 18px;
  letter-spacing: -.02em;
}

.current-profile small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 480;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-actions,
.conversation-actions {
  display: flex;
  align-items: center;
}

.sidebar-actions .icon-button {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
}

.search-box {
  position: relative;
  display: flex;
  height: 42px;
  align-items: center;
  margin: 2px 20px 11px;
  border: 1px solid #e6ebf0;
  border-radius: 12px;
  color: var(--muted);
  background: #f5f7f9;
}

.search-box > svg {
  width: 19px;
  height: 19px;
  margin-left: 13px;
}

.search-box input {
  height: 100%;
  min-width: 0;
  padding: 0 38px 0 10px;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: 14px;
}

.preview-clear {
  display: inline-grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
}

.preview-clear:hover {
  color: var(--ink);
  background: #e9edf2;
}

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

.search-box .preview-clear {
  position: absolute;
  right: 5px;
}

.sidebar-tabs {
  display: grid;
  height: 48px;
  grid-template-columns: 1fr 1fr;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
}

.sidebar-tabs button {
  position: relative;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 14px;
  font-weight: 600;
}

.sidebar-tabs button::after {
  content: "";
  position: absolute;
  right: 14px;
  bottom: -1px;
  left: 14px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: transparent;
}

.sidebar-tabs button.active {
  color: var(--accent-strong);
}

.sidebar-tabs button.active::after {
  background: var(--accent);
}

.chat-list,
.people,
.search-results {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #dce3eb transparent;
}

.chat-list {
  padding: 8px;
}

.chat-item,
.person,
.target-chat,
.search-result {
  width: 100%;
  border: 0;
  text-align: left;
  background: transparent;
}

.chat-item {
  position: relative;
  display: grid;
  min-height: 72px;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  transition: background-color .14s ease;
}

.chat-item:hover {
  background: #f5f8fb;
}

.chat-item.active {
  background: var(--accent-soft);
}

.avatar {
  position: relative;
  display: inline-grid;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  color: #fff;
  background: #91a8bd;
  font-size: 17px;
  font-weight: 700;
  user-select: none;
}

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

.group-avatar {
  background: var(--accent);
}

.chat-main {
  display: grid;
  min-width: 0;
  gap: 5px;
}

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

.chat-row-title strong {
  overflow: hidden;
  font-size: 15px;
  font-weight: 690;
  letter-spacing: -.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-row-title time {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.chat-main > span:last-child {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unread-badge {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  align-self: end;
  margin-bottom: 4px;
  padding: 0 7px;
  border-radius: 999px;
  color: #fff;
  background: var(--accent);
  font-size: 11px;
  font-weight: 750;
}

.people {
  display: none;
  padding: 8px;
}

.sidebar.show-contacts .chat-list {
  display: none;
}

.sidebar.show-contacts .people {
  display: block;
}

.people-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
}

.section-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.person {
  display: flex;
  min-height: 62px;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: 12px;
}

.person:hover {
  background: #f5f8fb;
}

.person-main {
  display: grid;
  gap: 3px;
}

.person-main strong {
  font-size: 14px;
}

.person-main small {
  color: var(--muted);
  font-size: 12px;
}

.invite-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  padding: 10px 18px max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: #fafcfd;
}

.invite-panel span {
  grid-column: 1;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
}

.invite-panel strong {
  overflow: hidden;
  grid-column: 1;
  font-size: 12px;
  text-overflow: ellipsis;
}

.invite-actions {
  display: flex;
  grid-column: 1 / -1;
  gap: 2px;
  margin: 5px -8px -4px;
}

.invite-actions .text-button {
  min-height: 28px;
  padding: 0 8px;
  font-size: 11px;
}

.search-results {
  position: absolute;
  z-index: 10;
  top: 70px;
  right: 12px;
  left: 12px;
  max-height: min(520px, calc(100% - 90px));
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  box-shadow: var(--shadow-float);
}

.search-result {
  display: grid;
  gap: 3px;
  padding: 10px 11px;
  border-radius: 10px;
}

.search-result:hover {
  background: #f3f7fa;
}

.search-result strong,
.search-result span,
.search-result small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result strong {
  font-size: 13px;
}

.search-result span {
  color: var(--ink-soft);
  font-size: 12px;
}

.search-result small {
  color: var(--muted);
  font-size: 10px;
}

.conversation {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: 76px auto minmax(0, 1fr) auto auto auto;
  background: var(--chat-bg);
}

.conversation-head {
  position: relative;
  z-index: 6;
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 96%);
  grid-row: 1;
}

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

.chat-identity > span:last-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.chat-identity h2 {
  overflow: hidden;
  margin: 0;
  font-size: 16px;
  font-weight: 720;
  letter-spacing: -.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-identity p {
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-avatar {
  width: 46px;
  height: 46px;
}

.conversation-actions {
  gap: 2px;
}

.group-call-banner {
  position: relative;
  z-index: 5;
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
  padding: 9px max(18px, calc((100% - 960px) / 2));
  color: #17476a;
  background: linear-gradient(90deg, #e7f6fd, #f2f9ff);
  box-shadow: inset 0 -1px #cde6f3;
  grid-row: 2;
}

.group-call-banner > span:nth-child(2) {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 2px;
}

.group-call-banner strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-call-banner small {
  color: #5e7c91;
  font-size: 10px;
}

.group-call-banner-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--success);
  box-shadow: 0 0 0 5px rgb(60 188 116 / 10%);
}

.group-call-banner-icon svg {
  width: 17px;
  height: 17px;
}

.group-call-banner.video .group-call-banner-icon {
  background: #7c58d6;
}

.group-call-banner .primary {
  min-height: 34px;
  padding: 0 13px;
  font-size: 11px;
}

.messages {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 20px max(26px, calc((100% - 960px) / 2)) 16px;
  overflow-anchor: none;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #ccd8e2 transparent;
  grid-row: 3;
}

.conversation > .attachment-preview {
  grid-row: 4;
}

.conversation > .reply-preview {
  grid-row: 5;
}

.conversation > .edit-preview {
  grid-row: 5;
}

.conversation > .composer {
  grid-row: 6;
}

.day-divider {
  display: flex;
  justify-content: center;
  margin: 10px 0 20px;
}

.day-divider span {
  padding: 6px 11px;
  border: 1px solid rgb(214 226 237 / 90%);
  border-radius: 999px;
  color: #66768b;
  background: rgb(255 255 255 / 82%);
  font-size: 11px;
  font-weight: 620;
}

.message {
  position: relative;
  display: flex;
  max-width: min(78%, 720px);
  align-items: flex-end;
  gap: 9px;
  margin: 7px 0;
}

.message.pending {
  animation: message-in .16s ease both;
}

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

.message.own > .avatar {
  display: none;
}

.message > .avatar {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
  margin-bottom: 2px;
  font-size: 13px;
}

.message-column {
  position: relative;
  display: grid;
  min-width: 0;
}

.bubble {
  position: relative;
  min-width: 100px;
  padding: 9px 12px 7px;
  border: 1px solid #e0e7ed;
  border-radius: 17px 17px 17px 5px;
  background: var(--incoming);
  box-shadow: 0 1px 1px rgb(46 68 91 / 4%);
}

.message.own .bubble {
  border-color: #bddff3;
  border-radius: 17px 17px 5px 17px;
  background: var(--outgoing);
}

.message.pending {
  opacity: .72;
}

.message.failed .bubble {
  border-color: #f6b4b9;
  background: var(--danger-soft);
}

.message-meta {
  margin-bottom: 4px;
}

.message-meta strong,
.reply-quote strong {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 690;
}

.forwarded {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
  color: var(--accent-strong);
}

.forwarded > span:first-child {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  place-items: center;
  border-radius: 50%;
  background: rgb(42 171 238 / 12%);
  font-size: 14px;
  font-weight: 760;
}

.forwarded > span:last-child {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.forwarded small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 560;
  letter-spacing: .015em;
}

.forwarded strong {
  overflow: hidden;
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-quote {
  display: grid;
  width: auto;
  min-width: 0;
  max-width: 100%;
  gap: 2px;
  margin: 0 0 7px;
  padding: 6px 9px 6px 10px;
  border: 0;
  border-left: 3px solid var(--accent);
  border-radius: 4px 10px 10px 4px;
  text-align: left;
  background: rgb(42 171 238 / 7%);
}

.reply-quote span {
  max-width: 360px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.28;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.message-text {
  color: #18212e;
  font-size: 15px;
  line-height: 1.38;
  overflow-wrap: anywhere;
}

.message-footer {
  display: flex;
  min-height: 14px;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  margin-top: 3px;
  color: #8491a1;
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}

.message-read-status {
  color: #8593a3;
  font-size: 11px;
  letter-spacing: -.14em;
}

.message-read-status.read {
  color: var(--accent-strong);
}

.message-tools {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: calc(100% + 6px);
  display: flex;
  align-items: center;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  opacity: 0;
  background: #fff;
  box-shadow: 0 5px 15px rgb(35 59 84 / 9%);
  transform: translateY(-50%) translateX(-4px);
  pointer-events: none;
  transition: opacity .13s ease, transform .13s ease;
}

.message.own .message-tools {
  right: calc(100% + 6px);
  left: auto;
}

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

.message-tools button {
  display: inline-grid;
  width: 29px;
  height: 29px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #5b697a;
  background: transparent;
  font-size: 13px;
}

.message-tools button:hover {
  background: var(--accent-soft);
}

.message-tools button svg {
  width: 15px;
  height: 15px;
}

.message-tools button.delete-tool {
  color: #d23d4d;
}

.message-tools button.delete-tool:hover {
  background: var(--danger-soft);
}

.message-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
}

.message.own .message-reactions {
  justify-content: flex-end;
}

.message-reactions button {
  min-width: 37px;
  height: 25px;
  padding: 0 8px;
  border: 1px solid #dce5ec;
  border-radius: 999px;
  background: rgb(255 255 255 / 90%);
  font-size: 12px;
}

.message-reactions button.mine {
  border-color: #9ed4f5;
  background: var(--accent-soft);
}

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

.swipe-reply-cue {
  position: absolute;
  top: 50%;
  right: -34px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: var(--accent);
  opacity: var(--swipe-progress, 0);
  background: #fff;
  transform: translateY(-50%) scale(calc(.75 + var(--swipe-progress, 0) * .25));
}

.message.swiping .bubble {
  transition: none;
}

.message:not(.swiping) .bubble {
  transition: transform .2s ease;
}

.message.search-hit .bubble {
  animation: search-hit 1.4s ease;
}

.sticker-bubble,
.video-bubble {
  padding: 0;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none;
}

.sticker-bubble .message-footer,
.video-bubble .message-footer {
  position: absolute;
  right: 8px;
  bottom: 7px;
  padding: 4px 6px;
  border-radius: 999px;
  color: #fff;
  background: rgb(17 24 39 / 44%);
}

.sticker-message {
  display: grid;
  width: 150px;
  height: 142px;
  place-items: center;
  filter: drop-shadow(0 8px 10px rgb(63 81 103 / 10%));
  font-size: 98px;
  line-height: 1;
  transform-origin: bottom;
  animation: sticker-pop .26s ease-out both;
}

.voice-message {
  display: flex;
  min-width: 280px;
  align-items: center;
  gap: 11px;
  padding: 3px 0 1px;
}

.media-play {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
}

.media-play svg {
  width: 20px;
  height: 20px;
}

.voice-track {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 3px;
}

.waveform {
  display: flex;
  height: 28px;
  align-items: center;
  gap: 2px;
}

.waveform i {
  width: 2px;
  height: calc(5px + var(--bar) * 19px);
  min-height: 5px;
  border-radius: 3px;
  background: var(--accent);
}

.media-duration {
  color: var(--muted);
  font-size: 10px;
}

.voice-message audio {
  display: none;
}

.video-note {
  position: relative;
  display: block;
  width: 224px;
  height: 224px;
  padding: 0;
  overflow: hidden;
  border: 4px solid #fff;
  border-radius: 50%;
  background: #c8d4dd;
  box-shadow: 0 8px 22px rgb(38 58 76 / 15%);
}

.video-note video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-note-play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: rgb(12 27 40 / 48%);
  transform: translate(-50%, -50%);
  transition: opacity .16s ease;
}

.video-note.playing .video-note-play {
  opacity: 0;
}

.video-note-duration {
  position: absolute;
  bottom: 13px;
  left: 50%;
  padding: 4px 7px;
  border-radius: 999px;
  color: #fff;
  background: rgb(12 27 40 / 52%);
  font-size: 10px;
  transform: translateX(-50%);
}

.attachment {
  margin-top: 6px;
}

.image-attachment {
  position: relative;
  display: block;
  max-width: 420px;
  overflow: hidden;
  border-radius: 12px;
  background: #dfe7ed;
}

.image-attachment img {
  display: block;
  max-width: 100%;
  max-height: 430px;
  object-fit: cover;
}

.image-attachment:not(.loaded) img {
  min-width: 220px;
  min-height: 150px;
  opacity: 0;
}

.attachment-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
}

.image-attachment.loaded .attachment-loading {
  display: none;
}

.file-attachment {
  display: grid;
  min-width: 230px;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 2px 10px;
  padding: 9px 10px;
  border: 1px solid rgb(42 171 238 / 18%);
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
  background: rgb(255 255 255 / 42%);
}

.file-attachment > span {
  display: grid;
  width: 42px;
  height: 42px;
  grid-row: 1 / span 2;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  font-size: 9px;
  font-weight: 720;
}

.file-attachment strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.file-audio,
.file-video {
  display: block;
  max-width: min(440px, 65vw);
  margin-top: 7px;
  border-radius: 12px;
}

.file-audio {
  min-width: 280px;
  height: 42px;
}

.empty-conversation {
  display: flex;
  height: 100%;
  min-height: 280px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  text-align: center;
}

.empty-conversation strong {
  color: var(--ink-soft);
  font-size: 15px;
}

.empty-conversation > span:last-child {
  font-size: 12px;
}

.empty-mark {
  display: grid;
  width: 64px;
  height: 64px;
  margin-bottom: 8px;
  place-items: center;
  border-radius: 50%;
  color: var(--accent-strong);
  background: rgb(255 255 255 / 72%);
  font-size: 20px;
  font-weight: 750;
}

.attachment-preview,
.reply-preview,
.edit-preview {
  position: relative;
  z-index: 7;
  display: flex;
  max-width: 920px;
  min-height: 50px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 auto;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 13px 13px 0 0;
  color: var(--ink-soft);
  background: #fff;
  font-size: 12px;
}

.reply-preview {
  box-shadow: 0 -4px 16px rgb(38 58 76 / 5%);
  border-left: 3px solid var(--accent);
}

.reply-preview > div {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 2px;
}

.reply-preview strong {
  color: var(--accent-strong);
  font-size: 12px;
}

.reply-preview span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edit-preview {
  border-left: 3px solid #7c58d6;
  box-shadow: 0 -4px 16px rgb(38 58 76 / 5%);
}

.edit-preview-icon {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border-radius: 50%;
  color: #7c58d6;
  background: #f1edfb;
}

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

.edit-preview > div {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 2px;
}

.edit-preview strong {
  color: #6c46cb;
  font-size: 12px;
}

.edit-preview > div span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delete-message-card {
  width: min(410px, 100%);
  text-align: center;
}

.delete-message-icon {
  display: grid;
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  place-items: center;
  border-radius: 50%;
  color: var(--danger);
  background: var(--danger-soft);
}

.delete-message-icon svg {
  width: 25px;
  height: 25px;
}

.delete-message-card h2 {
  margin: 0;
  font-size: 21px;
}

.delete-message-card > p {
  margin: 14px 10px 20px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.delete-message-preview {
  display: grid;
  gap: 4px;
  margin: 17px 0 0;
  padding: 12px 14px;
  overflow: hidden;
  border: 1px solid #e8edf1;
  border-radius: 13px;
  text-align: left;
  background: #f7f9fb;
}

.delete-message-preview strong {
  color: var(--accent-strong);
  font-size: 11px;
}

.delete-message-preview span {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.delete-message-actions {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 9px;
}

.danger-primary {
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-sm);
  color: #fff;
  background: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.danger-primary:hover {
  background: #d93646;
}

.call-bubble {
  min-width: 240px;
}

.call-message {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 3px 1px 2px;
}

.call-message-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
}

.call-message.missed .call-message-icon,
.call-message.declined .call-message-icon,
.call-message.failed .call-message-icon,
.call-message.busy .call-message-icon {
  background: var(--danger);
}

.call-message-icon svg {
  width: 20px;
  height: 20px;
}

.call-message > span:last-child {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.call-message strong {
  font-size: 13px;
}

.call-message small {
  color: var(--muted);
  font-size: 10px;
}

.custom-sticker-message {
  display: grid;
  width: 170px;
  height: 160px;
  place-items: center;
}

.custom-sticker-message img,
.custom-sticker-message video {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 7px 7px rgb(29 45 61 / 12%));
}

.composer-error {
  position: absolute;
  z-index: 8;
  right: 26px;
  bottom: 84px;
  max-width: 360px;
  margin: 0;
  padding: 8px 11px;
  border-radius: 9px;
  color: #a61b2b;
  background: #fff0f1;
  font-size: 11px;
}

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

.composer {
  position: relative;
  z-index: 6;
  display: flex;
  width: calc(100% - 40px);
  max-width: 980px;
  min-height: 70px;
  align-items: flex-end;
  gap: 7px;
  margin: 0 auto;
  padding: 9px 10px max(9px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--chat-bg);
}

.inline-recorder {
  position: absolute;
  z-index: 8;
  inset: 7px 8px max(7px, env(safe-area-inset-bottom));
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 0 5px 0 12px;
  border: 1px solid #dbe3ea;
  border-radius: 25px;
  background: #fff;
  box-shadow: 0 5px 20px rgb(31 53 71 / 10%);
}

.inline-recorder.locked {
  border-color: #c6e5f5;
}

.inline-recording-cancel,
.inline-recording-pause,
.inline-recording-send {
  border: 0;
  color: var(--accent-strong);
  background: transparent;
}

.inline-recording-cancel {
  padding: 8px 2px;
  font-size: 12px;
  font-weight: 680;
}

.inline-recording-video {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  object-fit: cover;
  border: 2px solid #c6e5f5;
  border-radius: 50%;
  background: #172936;
  transform: scaleX(-1);
}

.inline-recorder.video-mode .inline-recording-video {
  position: fixed;
  z-index: 12;
  top: 50%;
  left: calc(50% + 184px);
  width: clamp(220px, 28vw, 310px);
  height: clamp(220px, 28vw, 310px);
  border: 5px solid rgb(255 255 255 / 92%);
  background: #172936;
  box-shadow:
    0 0 0 5px rgb(76 179 229 / 32%),
    0 24px 70px rgb(25 45 61 / 34%);
  transform: translate(-50%, -50%) scaleX(-1);
  pointer-events: none;
}

.inline-recorder.video-mode.paused .inline-recording-video {
  filter: saturate(.55) brightness(.78);
}

.inline-recording-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: #ed4d5b;
  box-shadow: 0 0 0 4px rgb(237 77 91 / 10%);
  animation: inline-recording-blink 1.15s ease-in-out infinite;
}

.inline-recorder.paused .inline-recording-dot {
  animation: none;
  opacity: .38;
}

.inline-recording-timer {
  min-width: 34px;
  color: #263747;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.inline-recording-hint {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform: translateX(var(--record-slide-x, 0));
  opacity: var(--record-hint-opacity, 1);
}

.inline-recording-pause,
.inline-recording-send {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 50%;
}

.inline-recording-pause {
  background: var(--accent-pale);
}

.inline-recording-send {
  color: #fff;
  background: var(--accent);
}

.inline-recording-pause svg,
.inline-recording-send svg {
  width: 18px;
  height: 18px;
}

.record-lock-rail {
  position: absolute;
  z-index: 9;
  right: 9px;
  bottom: 59px;
  display: grid;
  width: 46px;
  height: 92px;
  place-items: center;
  border: 1px solid #d7e7f0;
  border-radius: 23px;
  color: var(--accent-strong);
  background: rgb(255 255 255 / 96%);
  box-shadow: 0 7px 24px rgb(31 53 71 / 16%);
  pointer-events: none;
  transform: translateY(var(--record-lock-progress, 0));
  transition: opacity .15s ease;
}

.record-lock-rail span {
  font-size: 21px;
  line-height: 1;
  animation: record-lock-nudge 1.2s ease-in-out infinite;
}

.record-lock-rail svg {
  width: 18px;
  height: 18px;
}

.composer > .icon-button {
  margin-bottom: 1px;
  color: #65748a;
}

.composer-field {
  display: flex;
  min-width: 0;
  min-height: 46px;
  flex: 1;
  align-items: flex-end;
  border: 1px solid #dbe3ea;
  border-radius: 23px;
  background: #fff;
}

.composer-field:focus-within {
  border-color: #b9ddef;
}

.composer textarea {
  min-width: 0;
  min-height: 44px;
  max-height: 130px;
  flex: 1;
  padding: 12px 6px 10px 16px;
  overflow-y: auto;
  border: 0;
  border-radius: 23px;
  background: transparent;
  box-shadow: none;
  resize: none;
  font-size: 15px;
  line-height: 1.42;
}

.composer-field .icon-button {
  width: 42px;
  height: 44px;
  flex-basis: 42px;
}

.voice-button,
.send {
  color: #fff !important;
  background: var(--accent) !important;
}

.voice-button {
  position: relative;
  touch-action: none;
  transition: transform .16s ease, background .16s ease, box-shadow .16s ease;
  user-select: none;
}

.voice-button::after {
  content: "";
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 7px;
  height: 7px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #fff;
  opacity: 0;
  transform: scale(.5);
  transition: opacity .16s ease, transform .16s ease;
}

.voice-button.video-mode {
  background: #7c58d6 !important;
  box-shadow: 0 5px 14px rgb(124 88 214 / 28%);
}

.voice-button.video-mode::after {
  opacity: 1;
  transform: scale(1);
}

.voice-button.holding {
  transform: scale(.9);
  box-shadow: 0 0 0 7px rgb(42 171 238 / 13%);
}

.voice-button.recording {
  background: #ed4d5b !important;
  box-shadow: 0 0 0 9px rgb(237 77 91 / 14%);
  transform: scale(1.05);
}

.send {
  display: inline-grid;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  place-items: center;
  border-radius: 50%;
}

.send svg {
  width: 20px;
  height: 20px;
  transform: translate(-1px, 1px);
}

.sticker-picker,
.attachment-menu {
  position: absolute;
  z-index: 15;
  bottom: 74px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-float);
  transform-origin: bottom;
  animation: picker-in .17s ease both;
}

.sticker-picker {
  right: max(64px, calc((100% - 920px) / 2 + 64px));
  width: min(410px, calc(100% - 32px));
  overflow: hidden;
}

.picker-tabs {
  display: flex;
  height: 52px;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}

.picker-tabs button {
  display: flex;
  height: 100%;
  align-items: center;
  gap: 7px;
  padding: 0 8px;
  border: 0;
  border-bottom: 2px solid var(--accent);
  color: var(--accent-strong);
  background: transparent;
  font-size: 13px;
  font-weight: 650;
}

.picker-tabs .sticker-upload-button {
  height: 34px;
  padding: 0 10px;
  border: 1px solid #cfe4f2;
  border-radius: 999px;
  color: var(--accent-strong);
  background: var(--accent-pale);
  font-size: 11px;
}

.picker-tabs .sticker-upload-button svg {
  width: 16px;
  height: 16px;
}

.sticker-library-note {
  padding: 8px 14px 2px;
  color: var(--muted);
  font-size: 10px;
}

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  max-height: 340px;
  padding: 10px;
  overflow: auto;
}

.sticker-grid button {
  display: grid;
  min-width: 0;
  aspect-ratio: 1;
  place-items: center;
  padding: 4px;
  border: 0;
  border-radius: 13px;
  background: transparent;
}

.sticker-grid button:hover {
  background: var(--accent-pale);
}

.sticker-grid button > span {
  font-size: 46px;
  line-height: 1;
  transition: transform .15s ease;
}

.sticker-grid .custom-sticker-thumb {
  display: grid;
  width: 66px;
  height: 60px;
  place-items: center;
  font-size: 0;
}

.custom-sticker-thumb img,
.custom-sticker-thumb video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.sticker-grid button:hover > span {
  transform: scale(1.12) rotate(-3deg);
}

.sticker-grid small {
  overflow: hidden;
  max-width: 100%;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-menu {
  left: max(20px, calc((100% - 920px) / 2));
  width: 270px;
  padding: 7px;
}

.attachment-menu button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 0;
  border-radius: 12px;
  text-align: left;
  background: transparent;
}

.attachment-menu button:hover {
  background: var(--accent-pale);
}

.forward-preview {
  display: flex;
  min-height: 64px;
  align-items: center;
  gap: 11px;
  margin: -4px 0 18px;
  padding: 10px 12px;
  border: 1px solid #d7e9f4;
  border-radius: 14px;
  background: var(--accent-pale);
}

.forward-preview:empty {
  display: none;
}

.forward-preview-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  font-size: 19px;
  font-weight: 760;
}

.forward-preview > span:last-child,
.target-chat-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.forward-preview small,
.target-chat-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.forward-preview strong,
.target-chat-copy strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.target-chat-copy {
  flex: 1;
}

.target-chat-arrow {
  color: #9aa7b5;
  font-size: 22px;
}

.attachment-menu button > svg {
  width: 22px;
  color: var(--accent-strong);
}

.attachment-menu button > span {
  display: grid;
  gap: 3px;
}

.attachment-menu strong {
  font-size: 13px;
}

.attachment-menu small {
  color: var(--muted);
  font-size: 10px;
}

.connection-banner {
  position: fixed;
  z-index: 100;
  top: 9px;
  left: 50%;
  max-width: min(560px, calc(100% - 28px));
  padding: 9px 14px;
  border-radius: 999px;
  color: #fff;
  background: #344054;
  box-shadow: 0 6px 20px rgb(15 23 42 / 18%);
  font-size: 12px;
  transform: translateX(-50%);
}

.toast-region {
  position: fixed;
  z-index: 130;
  top: 18px;
  right: 18px;
  display: grid;
  width: min(360px, calc(100% - 36px));
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  opacity: 0;
  color: var(--ink-soft);
  background: #fff;
  box-shadow: var(--shadow-float);
  font-size: 13px;
  line-height: 1.35;
  transform: translateY(-8px);
  transition: opacity .2s ease, transform .2s ease;
}

.toast.visible {
  opacity: 1;
  transform: none;
}

.toast.error {
  border-color: #fac5ca;
  color: #a61b2b;
  background: #fff4f5;
}

.modal,
.media-recorder,
.incoming-call {
  position: fixed;
  z-index: 90;
  inset: 0;
  display: grid;
  padding: 24px;
  overflow: auto;
  place-items: center;
  background: rgb(15 23 42 / 34%);
  backdrop-filter: blur(5px);
}

.modal-card,
.media-recorder-card,
.incoming-call-card {
  width: min(460px, 100%);
  max-height: min(780px, calc(100dvh - 48px));
  padding: 22px;
  overflow: auto;
  border: 1px solid rgb(255 255 255 / 55%);
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--shadow-modal);
  animation: modal-in .19s ease both;
}

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

.modal-head h2 {
  margin: 6px 0 0;
  font-size: 20px;
  letter-spacing: -.025em;
}

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

.modal-list,
.session-list {
  display: grid;
  gap: 7px;
  margin: 10px 0 18px;
}

.check-row,
.target-chat,
.session-item {
  display: flex;
  min-height: 54px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #f7f9fb;
}

.check-row input {
  width: 18px;
  height: 18px;
}

.check-row .avatar,
.target-chat .avatar {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
  font-size: 12px;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.profile-card {
  width: min(520px, 100%);
}

.profile-avatar-row {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
}

.profile-avatar {
  width: 70px;
  height: 70px;
  flex-basis: 70px;
  font-size: 24px;
}

.profile-avatar-row > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.switch-row {
  display: flex !important;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin: 0 !important;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f7f9fb;
}

.switch-row > span {
  display: grid;
  gap: 4px;
}

.switch-row strong {
  color: var(--ink);
  font-size: 13px;
}

.switch-row small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 450;
}

.switch-row input {
  position: relative;
  width: 42px;
  height: 24px;
  flex: 0 0 42px;
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: #c8d0d9;
  box-shadow: none;
}

.switch-row input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgb(15 23 42 / 22%);
  transition: transform .18s ease;
}

.switch-row input:checked {
  background: var(--accent);
}

.switch-row input:checked::after {
  transform: translateX(18px);
}

.notification-settings {
  display: grid;
  gap: 9px;
  margin-bottom: 20px;
}

.notification-test {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
}

.notification-help {
  margin: 0 4px;
}

.session-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.session-item strong {
  font-size: 12px;
}

.session-item small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 10px;
}

.user-profile-card {
  text-align: center;
}

.viewed-avatar {
  width: 92px;
  height: 92px;
  margin: 0 auto 14px;
  font-size: 30px;
}

.user-profile-card > h2 {
  margin: 0;
}

.user-description {
  color: var(--ink-soft);
  font-size: 13px;
}

.user-seen {
  display: block;
  margin-bottom: 18px;
  color: var(--muted);
}

.user-profile-card .primary {
  width: 100%;
}

.media-recorder {
  z-index: 105;
}

.media-recorder-card {
  width: min(520px, 100%);
}

.recording-stage {
  position: relative;
  display: grid;
  width: min(360px, 100%);
  aspect-ratio: 1;
  margin: 0 auto 22px;
  overflow: hidden;
  place-items: center;
  border-radius: 50%;
  background: #e8f1f7;
}

.recording-stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.audio-recording-visual {
  position: relative;
  display: grid;
  width: 128px;
  height: 128px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
}

.audio-recording-visual svg {
  width: 46px;
  height: 46px;
}

.recording-pulse {
  position: absolute;
  inset: -12px;
  border: 2px solid rgb(42 171 238 / 28%);
  border-radius: 50%;
  animation: recording-pulse 1.5s ease-out infinite;
}

.recording-timer {
  position: absolute;
  bottom: 16px;
  left: 50%;
  padding: 6px 10px;
  border-radius: 999px;
  color: #fff;
  background: rgb(15 23 42 / 54%);
  font-size: 12px;
  transform: translateX(-50%);
}

.media-recorder-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.record-button {
  display: flex;
  height: 46px;
  align-items: center;
  gap: 9px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: var(--accent);
}

.record-button > span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
}

.record-button strong {
  font-size: 13px;
}

.record-button.recording {
  background: var(--danger);
}

.record-button.recording > span {
  border-radius: 2px;
}

.incoming-call {
  z-index: 115;
  background: rgb(14 27 39 / 78%);
}

.incoming-call-card {
  position: relative;
  width: min(380px, 100%);
  padding: 34px 28px;
  overflow: hidden;
  color: #fff;
  text-align: center;
  background: #1f3547;
}

.incoming-rings {
  position: absolute;
  top: 34px;
  left: 50%;
  width: 106px;
  height: 106px;
  border: 2px solid rgb(71 214 136 / 45%);
  border-radius: 50%;
  pointer-events: none;
  transform: translateX(-50%);
  animation: incoming-ring 1.8s ease-out infinite;
}

.incoming-rings::after {
  content: "";
  position: absolute;
  inset: -2px;
  border: 2px solid rgb(71 214 136 / 36%);
  border-radius: inherit;
  animation: incoming-ring 1.8s .55s ease-out infinite;
}

.call-avatar {
  position: relative;
  z-index: 1;
  width: 106px;
  height: 106px;
  margin: 0 auto;
  border: 3px solid rgb(255 255 255 / 36%);
  font-size: 34px;
}

.incoming-call-card p {
  margin: 20px 0 6px;
  color: #c9d8e4;
  font-size: 13px;
}

.incoming-call-card h2 {
  margin: 0;
  font-size: 26px;
}

.incoming-actions {
  display: flex;
  justify-content: space-around;
  margin-top: 34px;
}

.call-action {
  display: grid;
  gap: 8px;
  place-items: center;
  border: 0;
  color: #fff;
  background: transparent;
  font-size: 11px;
}

.call-action svg {
  width: 28px;
  height: 28px;
}

.call-action::before {
  content: "";
  position: absolute;
}

.call-action > svg {
  box-sizing: content-box;
  padding: 15px;
  border-radius: 50%;
}

.call-action.reject > svg {
  background: var(--danger);
  transform: rotate(135deg);
}

.call-action.accept > svg {
  background: var(--success);
}

.call-screen {
  position: fixed;
  z-index: 110;
  inset: 0;
  overflow: hidden;
  color: #fff;
  background: #182633;
}

.group-call-grid {
  position: absolute;
  inset: 76px 20px 122px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 42vw), 1fr));
  grid-auto-rows: minmax(180px, 1fr);
  gap: 12px;
}

.group-call-tile {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 13%);
  border-radius: 22px;
  background: linear-gradient(145deg, #29465d, #1b303f);
  box-shadow: 0 12px 30px rgb(0 0 0 / 20%);
}

.group-call-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.group-call-tile.local video {
  transform: scaleX(-1);
}

.call-screen.rear-camera .local-video,
.call-screen.rear-camera .group-call-tile.local video {
  transform: none;
}

.group-call-tile.reconnecting {
  border-color: rgb(240 168 58 / 72%);
}

.group-call-tile.reconnecting .group-call-tile-label span:last-child,
.call-screen.reconnecting .call-top span {
  color: #ffd28c;
}

.group-call-tile .avatar {
  width: 92px;
  height: 92px;
  flex-basis: 92px;
  font-size: 30px;
  box-shadow: 0 0 0 16px rgb(255 255 255 / 5%);
}

.group-call-tile-label {
  position: absolute;
  right: 10px;
  bottom: 10px;
  left: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  background: rgb(8 18 26 / 58%);
  backdrop-filter: blur(10px);
  font-size: 11px;
}

.group-call-tile-label span:last-child {
  color: #a9e5c3;
}

.remote-video,
.audio-call-backdrop {
  position: absolute;
  width: 100%;
  height: 100%;
  inset: 0;
}

.remote-video {
  object-fit: cover;
}

.audio-call-backdrop {
  display: grid;
  place-items: center;
  background: #20384b;
}

.audio-call-backdrop .call-avatar {
  width: 150px;
  height: 150px;
  font-size: 46px;
  box-shadow: 0 0 0 22px rgb(255 255 255 / 5%);
}

.local-video {
  position: absolute;
  z-index: 2;
  top: 22px;
  right: 22px;
  width: min(22vw, 240px);
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border: 2px solid rgb(255 255 255 / 35%);
  border-radius: 18px;
  background: #0f1720;
  box-shadow: 0 10px 30px rgb(0 0 0 / 28%);
  transform: scaleX(-1);
}

.call-top {
  position: absolute;
  z-index: 3;
  top: max(18px, env(safe-area-inset-top));
  left: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-shadow: 0 2px 8px rgb(0 0 0 / 36%);
}

.call-top > div {
  display: grid;
  gap: 3px;
}

.call-top strong {
  font-size: 17px;
}

.call-top span {
  color: rgb(255 255 255 / 78%);
  font-size: 12px;
}

.call-controls {
  position: absolute;
  z-index: 3;
  right: 50%;
  bottom: max(28px, env(safe-area-inset-bottom));
  display: flex;
  align-items: flex-start;
  gap: clamp(10px, 2.5vw, 30px);
  padding: 16px 22px;
  border-radius: 26px;
  background: rgb(9 18 25 / 58%);
  backdrop-filter: blur(18px);
  transform: translateX(50%);
}

.call-control {
  position: relative;
  display: grid;
  min-width: 64px;
  gap: 7px;
  place-items: center;
  border: 0;
  color: #fff;
  background: transparent;
}

.call-control svg {
  box-sizing: content-box;
  width: 23px;
  height: 23px;
  padding: 13px;
  border-radius: 50%;
  background: rgb(255 255 255 / 18%);
}

.call-control span {
  font-size: 10px;
}

.call-control.off svg {
  background: #fff;
  color: #1f2937;
}

#toggleCallMic.off svg,
#toggleCallVideo.off svg,
#toggleSpeakerButton.off svg {
  color: #fff;
  background: rgb(255 255 255 / 18%);
}

#toggleCallMic.off::after,
#toggleCallVideo.off::after,
#toggleSpeakerButton.off::after {
  position: absolute;
  top: 23px;
  left: 50%;
  width: 34px;
  height: 3px;
  border: 1px solid rgb(83 12 23 / 50%);
  border-radius: 999px;
  background: #ff405c;
  box-shadow: 0 1px 5px rgb(108 10 27 / 45%);
  content: "";
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(-45deg);
}

.call-control.busy svg {
  animation: spin .75s linear infinite;
}

.call-control.attention svg {
  background: #f0a83a;
  animation: call-attention .85s ease-in-out infinite alternate;
}

.call-control.end svg {
  background: var(--danger);
  transform: rotate(135deg);
}

.call-screen.minimized {
  top: 14px;
  right: 14px;
  bottom: auto;
  left: auto;
  width: 260px;
  height: 150px;
  border: 2px solid #fff;
  border-radius: 18px;
  box-shadow: var(--shadow-modal);
}

.call-screen.minimized .call-controls,
.call-screen.minimized .local-video {
  display: none;
}

.call-screen.minimized .call-top {
  top: 8px;
  left: 8px;
}

.sidebar-backdrop,
.mobile-only {
  display: none;
}

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

@keyframes sticker-pop {
  0% { opacity: 0; transform: scale(.72) rotate(-6deg); }
  72% { opacity: 1; transform: scale(1.05) rotate(2deg); }
  100% { transform: scale(1); }
}

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

@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
}

@keyframes search-hit {
  0%, 100% { box-shadow: 0 0 0 0 rgb(42 171 238 / 0%); }
  30% { box-shadow: 0 0 0 5px rgb(42 171 238 / 25%); }
}

@keyframes recording-pulse {
  from { opacity: .8; transform: scale(.9); }
  to { opacity: 0; transform: scale(1.22); }
}

@keyframes inline-recording-blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .35; transform: scale(.82); }
}

@keyframes record-lock-nudge {
  0%, 100% { transform: translateY(3px); opacity: .55; }
  50% { transform: translateY(-4px); opacity: 1; }
}

@keyframes incoming-ring {
  0% { opacity: .9; transform: translateX(-50%) scale(.92); }
  100% { opacity: 0; transform: translateX(-50%) scale(1.65); }
}

@keyframes call-attention {
  from { transform: scale(.94); }
  to { transform: scale(1.07); }
}

@keyframes spin {
  to { transform: rotate(1turn); }
}

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

  .message {
    max-width: 86%;
  }

  .message-tools {
    display: none;
  }

  .message.actions-open .message-tools {
    top: -35px;
    right: 0;
    left: auto;
    display: flex;
  }

  .inline-recorder.video-mode .inline-recording-video {
    left: calc(50% + 165px);
  }
}

@media (max-width: 820px) {
  html {
    background: #fff;
  }

  .shell {
    position: fixed;
    inset: 0;
    height: var(--app-height);
  }

  .login {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
  }

  .login-visual {
    display: none;
  }

  .login-form {
    width: min(430px, calc(100% - 38px));
    margin: auto;
    padding: max(34px, env(safe-area-inset-top)) 0 max(34px, env(safe-area-inset-bottom));
  }

  .mobile-login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 34px;
  }

  .mobile-login-brand > div {
    display: grid;
    gap: 2px;
  }

  .mobile-login-brand strong {
    font-size: 20px;
  }

  .mobile-login-brand small {
    color: var(--muted);
    font-size: 11px;
  }

  .app {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
  }

  .sidebar,
  .conversation {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transition: transform .24s cubic-bezier(.2, .8, .2, 1);
  }

  .sidebar {
    z-index: 3;
    border: 0;
    transform: translateX(0);
  }

  .conversation {
    z-index: 4;
    grid-template-rows: 66px auto minmax(0, 1fr) auto auto auto;
    transform: translateX(100%);
  }

  .app.chat-open .sidebar {
    transform: translateX(-28%);
  }

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

  .sidebar-head {
    min-height: 70px;
    padding-top: max(10px, env(safe-area-inset-top));
  }

  .conversation-head {
    min-height: 66px;
    padding: max(7px, env(safe-area-inset-top)) 7px 7px 4px;
  }

  .conversation-head .mobile-only {
    display: inline-grid;
  }

  .conversation-avatar {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }

  .chat-identity {
    gap: 9px;
  }

  .chat-identity h2 {
    font-size: 15px;
  }

  .conversation-actions .icon-button {
    width: 39px;
    height: 39px;
    flex-basis: 39px;
  }

  .messages {
    padding: 14px 10px 10px;
  }

  .message {
    max-width: 88%;
    margin: 5px 0;
    gap: 6px;
  }

  .message > .avatar {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
    font-size: 11px;
  }

  .bubble {
    padding: 8px 10px 6px;
  }

  .message-text {
    font-size: 14px;
  }

  .voice-message {
    min-width: min(260px, 70vw);
  }

  .waveform {
    max-width: 48vw;
    overflow: hidden;
  }

  .video-note {
    width: min(210px, 58vw);
    height: min(210px, 58vw);
  }

  .sticker-message {
    width: 132px;
    height: 126px;
    font-size: 86px;
  }

  .custom-sticker-message {
    width: min(158px, 46vw);
    height: min(150px, 44vw);
  }

  .call-bubble {
    min-width: min(230px, 70vw);
  }

  .message-tools {
    display: none;
  }

  .message:focus-within .message-tools,
  .message.actions-open .message-tools {
    display: flex;
    top: -32px;
    right: 0;
    left: auto;
  }

  .composer {
    width: 100%;
    min-height: 62px;
    gap: 3px;
    padding: 7px 5px max(7px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: #fff;
  }

  .group-call-banner {
    padding: 8px 9px;
  }

  .group-call-banner .primary {
    padding: 0 10px;
  }

  .inline-recorder {
    inset: 5px 4px max(5px, env(safe-area-inset-bottom));
    gap: 7px;
    padding-left: 10px;
  }

  .inline-recorder.video-mode .inline-recording-video {
    top: 45%;
    left: 50%;
    width: min(68vw, 286px);
    height: min(68vw, 286px);
  }

  .inline-recording-hint {
    font-size: 10px;
  }

  .record-lock-rail {
    right: 3px;
    bottom: calc(55px + env(safe-area-inset-bottom));
  }

  .composer > .icon-button {
    width: 40px;
    height: 44px;
    flex-basis: 40px;
  }

  .composer-field {
    border-color: #e1e6eb;
  }

  .composer textarea {
    padding-left: 13px;
    font-size: 16px;
  }

  .attachment-preview,
  .reply-preview,
  .edit-preview {
    width: 100%;
    max-width: none;
    margin: 0;
    border-right: 0;
    border-left-width: 3px;
    border-radius: 0;
  }

  .sticker-picker {
    right: 8px;
    bottom: calc(67px + env(safe-area-inset-bottom));
    left: 8px;
    width: auto;
  }

  .attachment-menu {
    bottom: calc(67px + env(safe-area-inset-bottom));
    left: 8px;
  }

  .sticker-grid {
    grid-template-columns: repeat(4, 1fr);
    max-height: min(360px, 47dvh);
  }

  .modal,
  .media-recorder {
    align-items: end;
    padding: 0;
  }

  .modal-card,
  .media-recorder-card {
    width: 100%;
    max-height: min(88dvh, 760px);
    padding: 20px 18px max(20px, env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0;
  }

  .recording-stage {
    width: min(320px, 82vw);
  }

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

  .connection-banner {
    top: max(7px, env(safe-area-inset-top));
  }

  .call-screen .local-video {
    top: max(76px, calc(env(safe-area-inset-top) + 58px));
    right: 14px;
    width: 112px;
    border-radius: 15px;
  }

  .group-call-grid {
    inset: max(74px, calc(env(safe-area-inset-top) + 62px)) 9px 100px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(120px, 1fr);
    gap: 7px;
  }

  .group-call-grid:has(.group-call-tile:only-child) {
    grid-template-columns: 1fr;
  }

  .group-call-tile {
    border-radius: 15px;
  }

  .group-call-tile .avatar {
    width: 68px;
    height: 68px;
    flex-basis: 68px;
    font-size: 23px;
  }

  .call-controls {
    right: 10px;
    bottom: max(14px, env(safe-area-inset-bottom));
    left: 10px;
    justify-content: space-around;
    gap: 2px;
    padding: 12px 6px;
    border-radius: 22px;
    transform: none;
  }

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

  .call-control svg {
    width: 21px;
    height: 21px;
    padding: 12px;
  }

  .call-control span {
    font-size: 9px;
  }

  .call-screen.minimized {
    top: max(10px, env(safe-area-inset-top));
    right: 10px;
    width: 220px;
    height: 128px;
  }

  .keyboard-open .messages {
    scroll-behavior: auto;
  }
}

@media (max-width: 430px) {
  .conversation-actions .icon-button {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .conversation-actions svg {
    width: 20px;
    height: 20px;
  }

  .message {
    max-width: 93%;
  }

  .message > .avatar {
    display: none;
  }

  .voice-message {
    min-width: min(245px, 72vw);
  }

  .sticker-grid button > span {
    font-size: 40px;
  }

  .call-control:nth-child(3) {
    display: none;
  }
}

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

/* Telegram-like message actions and selection */
.message-selection-toolbar {
  position: absolute;
  z-index: 24;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  height: 70px;
  align-items: center;
  gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) 18px 10px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 7px 24px rgb(15 23 42 / 8%);
  backdrop-filter: blur(20px);
}

.selection-spacer {
  flex: 1;
}

.selection-action {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 13px;
  font-weight: 720;
}

.selection-action svg {
  width: 18px;
  height: 18px;
}

.selection-action.destructive {
  color: var(--danger);
  background: var(--danger-soft);
}

.message-select-marker {
  position: absolute;
  top: 50%;
  left: -39px;
  display: none;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  color: transparent;
  background: var(--surface);
  transform: translateY(-50%);
}

.messages.selection-mode .message {
  margin-left: 42px;
  cursor: pointer;
}

.messages.selection-mode .message-select-marker {
  display: grid;
}

.messages.selection-mode .message.selected .message-select-marker {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.message.selected::before {
  position: absolute;
  z-index: -1;
  inset: -5px -12px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 11%, transparent);
  content: "";
}

.message-context-layer {
  position: fixed;
  z-index: 90;
  inset: 0;
  background: rgb(8 17 27 / 16%);
  backdrop-filter: blur(1px);
}

.message-context-menu {
  position: fixed;
  display: grid;
  width: 228px;
  overflow: hidden;
  padding: 7px;
  border: 1px solid color-mix(in srgb, var(--line) 86%, transparent);
  border-radius: 17px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow-modal);
  backdrop-filter: blur(24px);
  animation: context-pop .16s ease-out;
}

.message-context-menu > button {
  display: flex;
  min-height: 43px;
  align-items: center;
  gap: 12px;
  padding: 0 11px;
  border: 0;
  border-radius: 10px;
  text-align: left;
  background: transparent;
  font-size: 14px;
  font-weight: 610;
}

.message-context-menu > button:hover {
  background: var(--accent-pale);
}

.message-context-menu > button svg,
.message-context-menu > button > span:first-child {
  display: grid;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  place-items: center;
  color: var(--accent-strong);
  font-size: 18px;
}

.message-context-menu > button.destructive,
.message-context-menu > button.destructive svg {
  color: var(--danger);
}

.message-context-reactions {
  display: flex;
  justify-content: space-between;
  padding: 5px 4px 9px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}

.message-context-reactions button {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 18px;
  transition: transform .14s ease, background-color .14s ease;
}

.message-context-reactions button:hover {
  background: var(--accent-soft);
  transform: scale(1.18);
}

.message.swipe-right .swipe-reply-cue {
  right: auto;
  left: -34px;
}

.media-delivery-status {
  display: flex;
  justify-self: end;
  align-items: center;
  gap: 4px;
  margin: 4px 8px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
}

.media-delivery-status strong {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: -.14em;
}

.media-delivery-status.read strong {
  color: var(--accent-strong);
}

.message.media-message.own .bubble > .message-footer {
  display: none;
}

/* Theme controls */
.theme-settings {
  display: grid;
  gap: 9px;
}

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

.theme-option {
  display: grid;
  min-width: 0;
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 14px;
  text-align: left;
  color: var(--ink);
  background: var(--surface);
}

.theme-option.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 17%, transparent);
}

.theme-option > span:last-child {
  display: grid;
  gap: 2px;
}

.theme-option strong {
  font-size: 12px;
}

.theme-option small {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-swatch {
  position: relative;
  display: block;
  height: 47px;
  overflow: hidden;
  border: 1px solid rgb(127 144 161 / 25%);
  border-radius: 9px;
  background: #eef5fb;
}

.theme-swatch::before,
.theme-swatch i {
  position: absolute;
  content: "";
}

.theme-swatch::before {
  top: 0;
  bottom: 0;
  left: 0;
  width: 34%;
  background: #fff;
}

.theme-swatch i {
  right: 5px;
  bottom: 6px;
  width: 48%;
  height: 14px;
  border-radius: 8px 8px 3px 8px;
  background: #dff1fd;
}

.theme-swatch.dark {
  background: #0c1822;
}

.theme-swatch.dark::before {
  background: #111d27;
}

.theme-swatch.dark i {
  background: #174a6b;
}

.theme-swatch.copper {
  background: #f9efe7;
}

.theme-swatch.copper::before {
  background: #fffaf6;
}

.theme-swatch.copper i {
  background: #b9512c;
}

/* Theme design tokens and full-surface overrides */
:root[data-theme="dark"] {
  --accent: #42a5f5;
  --accent-strong: #68b8f6;
  --accent-soft: #1c3345;
  --accent-pale: #132535;
  --ink: #edf5fb;
  --ink-soft: #c6d5e1;
  --muted: #8ea3b5;
  --line: #2a3e4e;
  --line-strong: #3a5264;
  --surface: #111d27;
  --chat-bg: #0c1822;
  --incoming: #1c2c38;
  --outgoing: #174a6b;
  --danger-soft: #3b2028;
  --shadow-float: 0 18px 55px rgb(0 0 0 / 36%), 0 2px 10px rgb(0 0 0 / 22%);
  --shadow-modal: 0 24px 80px rgb(0 0 0 / 55%);
  color-scheme: dark;
}

:root[data-theme="copper"] {
  --accent: #b9562e;
  --accent-strong: #93401f;
  --accent-soft: #f8e6dc;
  --accent-pale: #fff1e8;
  --ink: #2f211c;
  --ink-soft: #5e473c;
  --muted: #866e61;
  --line: #ead9ce;
  --line-strong: #dcc5b7;
  --surface: #fffaf6;
  --chat-bg: #f9efe7;
  --incoming: #fffaf5;
  --outgoing: #b9512c;
  --danger-soft: #fde9e5;
  --shadow-float: 0 18px 55px rgb(92 47 25 / 14%), 0 2px 10px rgb(92 47 25 / 8%);
  --shadow-modal: 0 24px 80px rgb(68 37 23 / 22%);
  color-scheme: light;
}

:root[data-theme] .sidebar,
:root[data-theme] .conversation-head,
:root[data-theme] .composer,
:root[data-theme] .modal-card,
:root[data-theme] .profile-card,
:root[data-theme] .sticker-picker,
:root[data-theme] .attachment-menu,
:root[data-theme] .reply-preview,
:root[data-theme] .edit-preview,
:root[data-theme] .notification-settings,
:root[data-theme] .invite-panel,
:root[data-theme] .session-item {
  color: var(--ink);
  border-color: var(--line);
  background-color: var(--surface);
}

:root[data-theme] .messages {
  background-color: var(--chat-bg);
}

:root[data-theme] .search-box,
:root[data-theme] .composer-field,
:root[data-theme] input,
:root[data-theme] textarea,
:root[data-theme] .target-chat,
:root[data-theme] .check-row,
:root[data-theme] .chat-item,
:root[data-theme] .person,
:root[data-theme] .message-tools,
:root[data-theme] .day-divider span,
:root[data-theme] .message-reactions button {
  color: var(--ink);
  border-color: var(--line);
  background-color: color-mix(in srgb, var(--surface) 92%, var(--chat-bg));
}

:root[data-theme] .toast {
  color: var(--ink);
  border: 1px solid var(--line);
  background: var(--surface);
}

:root[data-theme] .chat-item:hover,
:root[data-theme] .person:hover,
:root[data-theme] .target-chat:hover,
:root[data-theme] .attachment-menu button:hover {
  background-color: var(--accent-pale);
}

:root[data-theme] .chat-item.active {
  background-color: var(--accent-soft);
}

:root[data-theme] .bubble {
  color: var(--ink);
  border-color: var(--line);
  background: var(--incoming);
}

:root[data-theme] .message.own .bubble {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  background: var(--outgoing);
}

:root[data-theme] .message-text {
  color: inherit;
}

:root[data-theme="dark"] .message.own .bubble,
:root[data-theme="dark"] .message.own .message-text,
:root[data-theme="copper"] .message.own .bubble,
:root[data-theme="copper"] .message.own .message-text {
  color: #fff;
}

:root[data-theme="dark"] .message.own .message-footer,
:root[data-theme="dark"] .message.own .reply-quote span,
:root[data-theme="copper"] .message.own .message-footer,
:root[data-theme="copper"] .message.own .reply-quote span {
  color: rgb(255 255 255 / 72%);
}

:root[data-theme="dark"] .message.own .message-read-status.read,
:root[data-theme="copper"] .message.own .message-read-status.read {
  color: #fff;
}

:root[data-theme="dark"] .message.own .media-play,
:root[data-theme="copper"] .message.own .media-play {
  color: var(--outgoing);
  background: rgb(255 255 255 / 92%);
}

:root[data-theme="dark"] .message.own .waveform i,
:root[data-theme="copper"] .message.own .waveform i {
  background: rgb(255 255 255 / 82%);
}

:root[data-theme="dark"] .message.own .media-duration,
:root[data-theme="copper"] .message.own .media-duration {
  color: rgb(255 255 255 / 72%);
}

:root[data-theme] .reply-quote {
  color: var(--ink);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}

:root[data-theme] .icon-button,
:root[data-theme] .small-button,
:root[data-theme] .secondary {
  border-color: var(--line);
}

:root[data-theme="dark"] .login,
:root[data-theme="dark"] .login-form {
  color: var(--ink);
  background: #0f1a23;
}

:root[data-theme="dark"] .login-visual {
  background: #122331;
}

:root[data-theme="copper"] .login,
:root[data-theme="copper"] .login-form {
  color: var(--ink);
  background: #fff8f2;
}

:root[data-theme="copper"] .login-visual {
  background: #7e361d;
}

@keyframes context-pop {
  from { opacity: 0; transform: scale(.92) translateY(5px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@media (max-width: 680px) {
  .message-context-layer {
    background: rgb(8 17 27 / 34%);
  }

  .message-context-menu {
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    left: 8px !important;
    top: auto !important;
    width: auto;
    border-radius: 22px;
    padding: 8px;
    animation-name: context-sheet;
  }

  .message-context-menu > button {
    min-height: 47px;
    font-size: 15px;
  }

  .message-selection-toolbar {
    height: 62px;
    gap: 7px;
    padding-right: 9px;
    padding-left: 9px;
  }

  .message-selection-toolbar strong {
    font-size: 13px;
  }

  .selection-action {
    width: 42px;
    min-height: 42px;
    justify-content: center;
    padding: 0;
    font-size: 0;
  }

  .selection-action > span,
  .selection-action svg {
    font-size: 21px;
  }

  .theme-options {
    grid-template-columns: 1fr;
  }

  .theme-option {
    grid-template-columns: 82px 1fr;
    align-items: center;
  }

  .theme-swatch {
    height: 43px;
  }

  .messages.selection-mode .message {
    max-width: calc(93% - 26px);
    margin-left: 33px;
  }

  .message-select-marker {
    left: -34px;
  }
}

@keyframes context-sheet {
  from { opacity: 0; transform: translateY(35px); }
  to { opacity: 1; transform: translateY(0); }
}
