:root {
  color-scheme: dark;
  --bg: #050b14;
  --bg-deep: #030711;
  --surface: rgba(12, 24, 42, 0.88);
  --surface-solid: #0c182a;
  --surface-raised: #11223a;
  --surface-soft: rgba(255, 255, 255, 0.045);
  --border: rgba(174, 211, 255, 0.13);
  --border-strong: rgba(174, 211, 255, 0.24);
  --text: #f4f8ff;
  --muted: #91a3bb;
  --muted-strong: #b8c5d7;
  --cyan: #24d9ff;
  --blue: #3977ff;
  --purple: #8a65ff;
  --pink: #ff4fa3;
  --ok: #35e3a2;
  --warn: #ffcc65;
  --err: #ff6b7c;
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 28px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  --header-height: 72px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

html {
  background: var(--bg-deep);
}

body {
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% -10%, rgba(53, 105, 255, 0.18), transparent 33rem),
    radial-gradient(circle at 94% 12%, rgba(255, 79, 163, 0.11), transparent 28rem),
    linear-gradient(145deg, #050a13 0%, #081321 48%, #050a13 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

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

button {
  user-select: none;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

::selection {
  background: rgba(36, 217, 255, 0.25);
  color: #fff;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: rgba(160, 190, 225, 0.25);
  background-clip: padding-box;
}

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

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

.ambientOne {
  top: 8vh;
  left: -18rem;
  background: var(--cyan);
}

.ambientTwo {
  right: -20rem;
  bottom: -12rem;
  background: var(--pink);
}

.hidden {
  display: none !important;
}

.small {
  font-size: 12px;
}

.muted {
  color: var(--muted);
}

.srOnly {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.top {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  min-height: var(--header-height);
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 10px clamp(16px, 3vw, 38px);
  border-bottom: 1px solid var(--border);
  background: rgba(4, 10, 18, 0.76);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(22px) saturate(135%);
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brandLogo {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  box-shadow: 0 10px 26px rgba(44, 130, 255, 0.22);
}

.brandCopy {
  min-width: 0;
}

.title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.title span {
  color: var(--cyan);
}

.topActions,
.topMeta {
  display: flex;
  align-items: center;
  gap: 8px;
}

body:not(.app-connected) .topMeta,
body:not(.app-connected) .topButton {
  display: none;
}

.pill {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.topPill:not(.muted) {
  border-color: rgba(36, 217, 255, 0.25);
  background: rgba(36, 217, 255, 0.09);
  color: #baf5ff;
}

.btn,
.iconButton {
  border: 0;
  color: #fff;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, opacity 160ms ease;
}

.btn {
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid rgba(86, 158, 255, 0.42);
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #2d71ff 0%, #6d55ff 100%);
  box-shadow: 0 12px 28px rgba(54, 96, 255, 0.2);
  font-weight: 750;
}

.btn:hover,
.iconButton:hover {
  transform: translateY(-1px);
}

.btn:active,
.iconButton:active {
  transform: translateY(0) scale(0.98);
}

.btn:disabled,
.iconButton:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.btn.ghost {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.055);
  box-shadow: none;
  color: var(--text);
}

.btn.ghost:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.085);
}

.btn.danger {
  border-color: rgba(255, 107, 124, 0.3);
  background: rgba(255, 107, 124, 0.1);
  box-shadow: none;
  color: #ffabb5;
}

.btnWide {
  width: 100%;
}

.iconButton {
  display: inline-flex;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted-strong);
  font-size: 19px;
}

.iconButton:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.primaryIcon {
  border-color: rgba(57, 119, 255, 0.45);
  background: linear-gradient(135deg, #2d71ff, #7456ff);
  color: #fff;
  box-shadow: 0 10px 24px rgba(57, 99, 255, 0.22);
}

.input,
input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  background: rgba(2, 9, 18, 0.52);
  color: var(--text);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input,
textarea,
select {
  padding: 11px 13px;
}

input::placeholder,
textarea::placeholder {
  color: #71849d;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(36, 217, 255, 0.5);
  background: rgba(3, 13, 26, 0.72);
  box-shadow: 0 0 0 3px rgba(36, 217, 255, 0.08);
}

select {
  cursor: pointer;
}

.smallSelect {
  width: auto;
  min-width: 70px;
  padding: 8px 30px 8px 11px;
}

.view {
  width: 100%;
}

.loginView {
  display: grid;
  min-height: calc(100dvh - var(--header-height));
  place-items: center;
  padding: clamp(28px, 6vh, 72px) clamp(18px, 4vw, 64px);
}

.loginShell {
  display: grid;
  width: min(1120px, 100%);
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  align-items: center;
  gap: clamp(38px, 7vw, 90px);
}

.loginIntro {
  max-width: 650px;
}

.eyebrow,
.qrKicker,
.modalKicker {
  color: #8ddfff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 18px;
  padding: 7px 11px;
  border: 1px solid rgba(36, 217, 255, 0.15);
  border-radius: 999px;
  background: rgba(36, 217, 255, 0.06);
}

.liveDot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 5px rgba(53, 227, 162, 0.09), 0 0 18px rgba(53, 227, 162, 0.8);
}

h1 {
  max-width: 620px;
  margin: 0;
  font-size: clamp(42px, 5.4vw, 72px);
  font-weight: 830;
  letter-spacing: -0.055em;
  line-height: 0.98;
  text-wrap: balance;
}

.loginLead {
  max-width: 590px;
  margin: 24px 0 28px;
  color: var(--muted-strong);
  font-size: clamp(17px, 2vw, 20px);
  line-height: 1.65;
}

.loginLead b {
  color: #fff;
}

.featureGrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.featureCard {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.032);
}

.featureCard strong,
.featureCard span {
  display: block;
}

.featureCard strong {
  margin-bottom: 4px;
  color: #ecf4ff;
  font-size: 13px;
}

.featureCard div > span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.featureIcon {
  display: grid !important;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(135deg, rgba(36, 217, 255, 0.16), rgba(138, 101, 255, 0.18));
  color: #b4f2ff;
  font-size: 16px;
  font-weight: 800;
}

.howTo {
  display: grid;
  margin-top: 28px;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.step > span {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  place-items: center;
  border: 1px solid rgba(138, 101, 255, 0.4);
  border-radius: 50%;
  background: rgba(138, 101, 255, 0.12);
  color: #c9bcff;
  font-size: 11px;
  font-weight: 800;
}

.step p {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.step b {
  color: var(--muted-strong);
}

.card,
.sidebar,
.chat,
.modalCard {
  border: 1px solid var(--border);
  background: linear-gradient(145deg, rgba(17, 33, 56, 0.93), rgba(7, 17, 31, 0.94));
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.loginCard {
  width: 100%;
  padding: clamp(20px, 3vw, 30px);
  border-radius: var(--radius-lg);
}

.qrHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.qrHeader h2 {
  margin: 4px 0 0;
  font-size: 21px;
  letter-spacing: -0.025em;
}

.ttlPill {
  min-width: 74px;
  border-color: rgba(53, 227, 162, 0.2);
  background: rgba(53, 227, 162, 0.07);
  color: #9bf0ce;
}

.qrWrap {
  position: relative;
  display: grid;
  min-height: 318px;
  margin: 20px 0 14px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(174, 211, 255, 0.12);
  border-radius: 22px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    rgba(3, 10, 20, 0.7);
  background-size: 24px 24px;
}

.qrGlow {
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--purple), var(--pink));
  filter: blur(62px);
  opacity: 0.18;
}

#qrCanvas {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(280px, calc(100% - 38px));
  aspect-ratio: 1;
  padding: 12px;
  place-items: center;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.38);
}

#qrCanvas canvas,
#qrCanvas img {
  display: block;
  width: 100% !important;
  height: auto !important;
  image-rendering: pixelated;
}

.fallback {
  position: relative;
  z-index: 1;
  width: calc(100% - 34px);
  padding: 18px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted-strong);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  text-align: center;
  word-break: break-all;
}

.status {
  min-height: 44px;
  margin: 0 0 12px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: rgba(0, 0, 0, 0.18);
  font-size: 12px;
}

.status.ok {
  border-color: rgba(53, 227, 162, 0.2);
  background: rgba(53, 227, 162, 0.07);
  color: #9bf0ce;
}

.status.warn {
  border-color: rgba(255, 204, 101, 0.22);
  background: rgba(255, 204, 101, 0.07);
  color: #ffe1a4;
}

.status.err {
  border-color: rgba(255, 107, 124, 0.22);
  background: rgba(255, 107, 124, 0.07);
  color: #ffadb8;
}

.privacyNote {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 16px;
  color: #8093ad;
  font-size: 11px;
}

.privacyNote span {
  color: var(--ok);
}

.privacyNote p {
  margin: 0;
}

.details {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 13px;
}

.details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 14px;
}

.field label,
.label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.hint {
  margin-top: 4px;
  font-size: 11px;
}

code {
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
}

.appView {
  padding: 14px clamp(12px, 2.2vw, 30px) 22px;
}

.layout {
  display: grid;
  width: min(1500px, 100%);
  height: calc(100dvh - var(--header-height) - 36px);
  min-height: 600px;
  margin: 0 auto;
  grid-template-columns: minmax(290px, 360px) minmax(0, 1fr);
  gap: 14px;
}

.sidebar,
.chat {
  min-width: 0;
  overflow: hidden;
  border-radius: 22px;
}

.sidebar {
  display: flex;
  flex-direction: column;
}

.sideTop {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}

.searchWrap {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 7px;
  padding-left: 11px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(2, 9, 18, 0.45);
  color: var(--muted);
}

.search {
  min-width: 0;
  padding-left: 0;
  border: 0;
  background: transparent;
  box-shadow: none !important;
}

.tabs {
  display: flex;
  padding: 0 8px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
}

.tab {
  position: relative;
  min-width: max-content;
  flex: 1;
  padding: 13px 10px 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
}

.tab::after {
  position: absolute;
  right: 14px;
  bottom: -1px;
  left: 14px;
  height: 2px;
  border-radius: 999px 999px 0 0;
  background: linear-gradient(90deg, var(--cyan), var(--purple));
  content: "";
  opacity: 0;
  transform: scaleX(0.6);
  transition: 160ms ease;
}

.tab.active {
  color: #fff;
}

.tab.active::after {
  opacity: 1;
  transform: scaleX(1);
}

.tab.hasBadge::before {
  display: inline-flex;
  min-width: 17px;
  height: 17px;
  align-items: center;
  justify-content: center;
  margin-left: 5px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  content: attr(data-badge);
  font-size: 10px;
}

.list {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 8px;
}

.item {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 3px;
  padding: 11px;
  border: 1px solid transparent;
  border-radius: 15px;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.item:hover {
  background: rgba(255, 255, 255, 0.045);
  transform: translateX(2px);
}

.item.active {
  border-color: rgba(36, 217, 255, 0.18);
  background: linear-gradient(90deg, rgba(36, 217, 255, 0.09), rgba(138, 101, 255, 0.08));
}

.avatar {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 15px;
  background: linear-gradient(145deg, rgba(36, 217, 255, 0.12), rgba(138, 101, 255, 0.14));
  color: #e8f6ff;
  font-size: 14px;
  font-weight: 800;
}

.avatar img {
  grid-area: 1 / 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 120ms ease;
}

.avatarFallback {
  grid-area: 1 / 1;
}

.avatar.hasImage img {
  opacity: 1;
}

.avatar.hasImage .avatarFallback {
  visibility: hidden;
}

.avatarLarge {
  width: 45px;
  height: 45px;
  flex-basis: 45px;
}

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

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

.itemName {
  overflow: hidden;
  font-size: 13px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.itemTime {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
}

.itemPreview {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Le richieste hanno due azioni: su una sidebar stretta i pulsanti non devono
   comprimere nickname, data e descrizione sulla stessa riga. */
#listRequests .item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 9px 11px;
  cursor: default;
}

#listRequests .item > .avatar {
  grid-column: 1;
  grid-row: 1;
}

#listRequests .item > .itemMain {
  grid-column: 2;
  grid-row: 1;
}

#listRequests .itemName {
  min-width: 0;
  color: var(--text);
}

#listRequests .itemTop {
  display: grid;
  justify-content: stretch;
  gap: 2px;
}

#listRequests .itemTime {
  white-space: normal;
  line-height: 1.35;
}

#listRequests .itemPreview {
  color: var(--muted-strong);
}

#listRequests .item > .row {
  display: grid;
  width: 100%;
  margin-left: 0 !important;
  grid-column: 1 / -1;
  grid-row: 2;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

#listRequests .smallBtn {
  min-width: 0;
  min-height: 38px;
  padding: 8px 12px;
}

.badge {
  display: inline-flex;
  min-width: 21px;
  height: 21px;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border: 1px solid rgba(53, 227, 162, 0.28);
  border-radius: 999px;
  background: rgba(53, 227, 162, 0.12);
  color: #9bf0ce;
  font-size: 10px;
  font-weight: 800;
}

.chat {
  display: flex;
  flex-direction: column;
}

.chatHeader {
  display: flex;
  min-height: 73px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 23, 40, 0.6);
}

.chatHeadLeft,
.chatHeadRight {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
}

.chatIdentity {
  min-width: 0;
}

.chatTitle {
  overflow: hidden;
  font-weight: 800;
  letter-spacing: -0.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chatSub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.companionBadge {
  max-width: 230px;
  overflow: hidden;
  padding: 6px 10px;
  border: 1px solid rgba(36, 217, 255, 0.14);
  border-radius: 999px;
  background: rgba(36, 217, 255, 0.055);
  color: #a8dce9;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.headerActionGroup {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border: 1px solid rgba(174, 211, 255, 0.12);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(16, 34, 57, 0.78), rgba(7, 18, 33, 0.9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 10px 28px rgba(0, 0, 0, 0.16);
}

.headerActionButton {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
  border-color: transparent;
  border-radius: 11px;
  background: transparent;
  color: #9eb3ca;
}

.headerActionButton:hover,
.headerActionButton:focus-visible {
  border-color: rgba(91, 193, 255, 0.18);
  background: linear-gradient(145deg, rgba(46, 116, 220, 0.2), rgba(108, 82, 224, 0.16));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 7px 18px rgba(26, 89, 174, 0.16);
  color: #e5f8ff;
  outline: none;
}

.headerGroupManage {
  width: auto;
  min-width: 0;
  height: 36px;
  flex-basis: auto;
  gap: 7px;
  padding: 7px 10px;
  border-radius: 11px;
  color: #c5d8eb;
  font-size: 11px;
  white-space: nowrap;
}

.headerGroupManage .headerActionIcon {
  width: 18px;
  height: 18px;
}

.headerGroupManageLabel {
  overflow: hidden;
  max-width: 150px;
  text-overflow: ellipsis;
}

.headerActionButton:focus-visible {
  box-shadow: 0 0 0 3px rgba(36, 217, 255, 0.12);
}

.headerActionIcon,
.headerActionIcon svg {
  display: block;
  width: 19px;
  height: 19px;
}

.headerActionIcon svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
}

#btnCallAudio:hover {
  color: #8defff;
}

#btnCallVideo:hover {
  color: #c4b4ff;
}

.messageStage {
  position: relative;
  min-height: 0;
  flex: 1;
}

.messages {
  position: absolute;
  inset: 0;
  overflow: auto;
  padding: 18px clamp(14px, 2.4vw, 30px);
  background:
    radial-gradient(circle at 90% 5%, rgba(138, 101, 255, 0.04), transparent 18rem),
    radial-gradient(circle at 10% 100%, rgba(36, 217, 255, 0.035), transparent 19rem),
    rgba(2, 9, 18, 0.25);
  scroll-behavior: smooth;
}

.messages.openingChat {
  visibility: hidden;
  scroll-behavior: auto;
}

.messages::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(rgba(164, 198, 235, 0.07) 0.7px, transparent 0.7px);
  background-size: 24px 24px;
  content: "";
  mask-image: linear-gradient(to bottom, transparent, #000 20%, #000 80%, transparent);
}

.messages.dragover {
  background: rgba(36, 217, 255, 0.055);
}

.latestMessageButton {
  position: absolute;
  z-index: 6;
  right: 18px;
  bottom: 16px;
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  padding: 8px 13px 8px 9px;
  border-color: rgba(74, 191, 255, 0.4);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(31, 99, 219, 0.96), rgba(105, 74, 224, 0.96));
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.34), 0 0 0 1px rgba(149, 225, 255, 0.08);
  color: #f2fbff;
  font-size: 12px;
  animation: latestMessageButtonIn 180ms ease-out both;
}

.latestMessageButton:hover {
  border-color: rgba(130, 225, 255, 0.7);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.38), 0 0 18px rgba(65, 184, 255, 0.16);
}

.latestMessageButton:focus-visible {
  outline: 2px solid rgba(150, 235, 255, 0.95);
  outline-offset: 2px;
}

.latestMessageArrow {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid rgba(221, 246, 255, 0.32);
  border-radius: 50%;
  background: rgba(2, 12, 25, 0.25);
  font-size: 17px;
  line-height: 1;
}

@keyframes latestMessageButtonIn {
  from {
    opacity: 0;
    transform: translateY(7px) scale(0.97);
  }
}

.dropHint {
  position: absolute;
  inset: 14px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border: 2px dashed rgba(36, 217, 255, 0.5);
  border-radius: 22px;
  background: rgba(4, 15, 28, 0.88);
  box-shadow: inset 0 0 70px rgba(36, 217, 255, 0.06);
  color: #dffbff;
  pointer-events: none;
}

.dropHint strong {
  margin-top: 12px;
  font-size: 18px;
}

.dropHint small {
  margin-top: 3px;
  color: var(--muted);
}

.dropIcon {
  display: grid;
  width: 62px;
  height: 62px;
  place-items: center;
  border: 1px solid rgba(36, 217, 255, 0.24);
  border-radius: 20px;
  background: rgba(36, 217, 255, 0.09);
  color: var(--cyan);
  font-size: 28px;
}

.emptyState {
  display: flex;
  min-height: 100%;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 40px 20px;
  color: var(--muted);
  text-align: center;
}

.emptyIcon {
  display: grid;
  width: 72px;
  height: 72px;
  margin-bottom: 16px;
  place-items: center;
  border: 1px solid rgba(36, 217, 255, 0.16);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(36, 217, 255, 0.09), rgba(138, 101, 255, 0.1));
  box-shadow: 0 18px 50px rgba(28, 93, 170, 0.12);
  font-size: 29px;
}

.emptyTitle {
  color: var(--text);
  font-size: 19px;
  font-weight: 800;
}

.emptyDetail {
  max-width: 420px;
  margin-top: 6px;
  line-height: 1.6;
}

.bubbleRow {
  display: flex;
  margin: 8px 0;
  animation: bubbleIn 180ms ease-out both;
}

@keyframes bubbleIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
}

.bubbleRow.me {
  justify-content: flex-end;
}

.bubble {
  max-width: min(76%, 720px);
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px 17px 17px;
  background: rgba(19, 37, 61, 0.94);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}

.bubbleRow.me .bubble {
  border-color: rgba(79, 131, 255, 0.24);
  border-radius: 17px 6px 17px 17px;
  background: linear-gradient(135deg, rgba(40, 91, 190, 0.86), rgba(85, 64, 178, 0.82));
}

.text {
  color: #eef5ff;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.messageLink {
  color: #62c7ff;
  font-weight: 750;
  text-decoration: underline;
  text-decoration-color: rgba(98, 199, 255, 0.52);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.messageLink:hover,
.messageLink:focus-visible {
  color: #a6e6ff;
  text-decoration-color: currentColor;
}

.linkPreviewSlot {
  width: min(430px, 100%);
  margin-top: 9px;
}

.linkPreviewSlot:empty {
  min-height: 1px;
  margin-top: 0;
}

.linkPreviewCard {
  display: grid;
  overflow: hidden;
  border: 1px solid rgba(129, 200, 255, 0.24);
  border-radius: 13px;
  color: #edf7ff;
  background: rgba(2, 12, 27, 0.62);
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.14);
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.linkPreviewCard:hover,
.linkPreviewCard:focus-visible {
  border-color: rgba(109, 213, 255, 0.58);
  background: rgba(5, 21, 42, 0.78);
  transform: translateY(-1px);
  outline: none;
}

.linkPreviewImage {
  display: block;
  width: 100%;
  max-height: 220px;
  aspect-ratio: 1.91 / 1;
  object-fit: cover;
  background: rgba(0, 5, 12, 0.72);
}

.linkPreviewDetails {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 11px 12px 12px;
}

.linkPreviewDomain {
  color: #72d5ff;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.linkPreviewTitle {
  display: -webkit-box;
  overflow: hidden;
  color: #f4f9ff;
  font-size: 14px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.linkPreviewDescription {
  display: -webkit-box;
  overflow: hidden;
  color: rgba(207, 225, 247, 0.76);
  font-size: 12px;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 7px;
  color: rgba(191, 210, 234, 0.64);
  font-size: 10px;
}

.sender {
  color: #a9eefe;
  font-weight: 750;
}

.mediaCard,
.voiceCard,
.voiceTextCard,
.callInviteCard,
.callInfoCard {
  padding: 11px;
  border: 1px solid rgba(174, 211, 255, 0.13);
  border-radius: 13px;
  background: rgba(2, 9, 18, 0.3);
}

.mediaThumb {
  display: block;
  width: 100%;
  max-height: 310px;
  margin-top: 9px;
  border-radius: 11px;
  object-fit: cover;
}

.mediaActions,
.callInviteActions,
.callActions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.callActions {
  justify-content: center;
}

.callMuteControl {
  position: relative;
  justify-content: center;
  min-width: 184px;
  gap: 9px;
}

.callMuteIcon {
  position: relative;
  display: inline-grid;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  place-items: center;
}

.callMuteGlyph {
  font-size: 17px;
  line-height: 1;
}

.callMuteSlash {
  position: absolute;
  top: 50%;
  left: 1px;
  width: 22px;
  height: 3px;
  border: 1px solid rgba(255, 214, 220, 0.88);
  border-radius: 999px;
  background: #ff5d73;
  box-shadow: 0 0 0 2px rgba(9, 21, 37, 0.7), 0 0 11px rgba(255, 93, 115, 0.56);
  opacity: 0;
  transform: translateY(-50%) rotate(-45deg) scaleX(0);
  transform-origin: center;
  transition: transform 240ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 150ms ease;
}

.callMuteControl.is-muted {
  border-color: rgba(255, 93, 115, 0.72);
  background: rgba(255, 93, 115, 0.13);
  color: #ffd9df;
}

.callMuteControl.is-muted .callMuteSlash {
  opacity: 1;
  transform: translateY(-50%) rotate(-45deg) scaleX(1);
}

.callMuteControl:focus-visible {
  outline: 2px solid rgba(111, 226, 255, 0.9);
  outline-offset: 2px;
}

.link {
  color: #9ceeff;
  font-weight: 700;
  text-decoration: none;
}

.link:hover {
  text-decoration: underline;
}

.voiceTop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.voiceLabel {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 750;
}

.voicePlayButton {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  flex: 0 0 44px;
  place-items: center;
  border: 1px solid rgba(105, 227, 255, 0.32);
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(38, 193, 255, 0.22), rgba(108, 81, 255, 0.28));
  color: #eafbff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.voicePlayButton:hover,
.voicePlayButton:focus-visible {
  border-color: rgba(119, 235, 255, 0.62);
  background: linear-gradient(145deg, rgba(38, 193, 255, 0.32), rgba(108, 81, 255, 0.4));
  outline: none;
  transform: translateY(-1px);
}

.voicePlayButton:focus-visible {
  box-shadow: 0 0 0 3px rgba(39, 215, 255, 0.18), 0 8px 20px rgba(0, 0, 0, 0.2);
}

.voicePlayButton:disabled {
  cursor: wait;
}

.voicePlayButtonIcon {
  width: 0;
  height: 0;
  margin-left: 3px;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 11px solid currentColor;
}

.voicePlayButton.isPlaying .voicePlayButtonIcon {
  width: 12px;
  height: 14px;
  margin: 0;
  border: 0;
  background: linear-gradient(
    90deg,
    currentColor 0 32%,
    transparent 32% 68%,
    currentColor 68% 100%
  );
}

.voicePlayButton.isLoading .voicePlayButtonIcon {
  width: 17px;
  height: 17px;
  margin: 0;
  border: 2px solid rgba(234, 251, 255, 0.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: voicePlaySpin 700ms linear infinite;
}

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

.messageTranslation {
  margin-top: 10px;
  padding: 10px 12px;
  border-inline-start: 3px solid #27d7ff;
  border-radius: 10px;
  background: rgba(39, 215, 255, 0.08);
}

.messageTranslationLabel {
  margin-bottom: 4px;
  color: #67e8f9;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.messageTranslationText {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.voiceCard audio {
  display: block;
  width: min(420px, 100%);
  min-height: 44px;
  accent-color: var(--accent);
}

.reactionsRow {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 9px;
  flex-wrap: wrap;
}

.reactionChip,
.reactionAddBtn {
  min-height: 27px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
  cursor: pointer;
  font-size: 11px;
}

.reactionAddBtn {
  display: grid;
  width: 29px;
  padding: 0;
  place-items: center;
  color: var(--muted-strong);
}

.reactionAddBtn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.reactionAddBtn:hover {
  border-color: rgba(36, 217, 255, 0.3);
  background: rgba(36, 217, 255, 0.09);
  color: #c9f7ff;
}

.reactionChip.mine {
  border-color: rgba(36, 217, 255, 0.3);
  background: rgba(36, 217, 255, 0.1);
}

.reactionPicker {
  display: grid;
  grid-template-columns: repeat(7, 30px);
  gap: 4px;
  max-height: 190px;
  padding: 7px;
  overflow-y: auto;
  border: 1px solid rgba(174, 211, 255, 0.16);
  border-radius: 16px;
  background: rgba(8, 21, 38, 0.96);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  animation: reactionPickerIn 140ms ease-out both;
}

@keyframes reactionPickerIn {
  from {
    opacity: 0;
    transform: translateX(-4px) scale(0.96);
  }
}

.reactionOption {
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  font-size: 17px;
  transition: background 120ms ease, transform 120ms ease;
}

.reactionOption:hover,
.reactionOption:focus-visible {
  background: rgba(255, 255, 255, 0.09);
  outline: none;
  transform: translateY(-2px) scale(1.08);
}

.uploadQueue {
  display: flex;
  gap: 8px;
  padding: 9px 12px;
  overflow-x: auto;
  border-top: 1px solid var(--border);
  background: rgba(4, 13, 24, 0.82);
}

.uploadItem {
  display: grid;
  min-width: 210px;
  max-width: 280px;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 9px;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
}

.uploadItemIcon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 9px;
  background: rgba(57, 119, 255, 0.14);
  color: #a9c4ff;
}

.uploadItemMain {
  min-width: 0;
}

.uploadItemName,
.uploadItemStatus {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uploadItemName {
  color: #eaf3ff;
  font-size: 11px;
  font-weight: 700;
}

.uploadItemStatus {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.uploadProgress {
  height: 3px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.uploadProgressBar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--purple));
  transition: width 120ms linear;
}

.uploadItem.done .uploadItemIcon {
  background: rgba(53, 227, 162, 0.1);
  color: var(--ok);
}

.uploadItem.error .uploadItemIcon {
  background: rgba(255, 107, 124, 0.1);
  color: var(--err);
}

.composerShell {
  border-top: 1px solid var(--border);
  background: rgba(8, 20, 36, 0.87);
}

.replyComposer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 12px 0;
  padding: 8px 10px;
  border-inline-start: 3px solid var(--accent);
  border-radius: 10px;
  background: rgba(36, 217, 255, 0.08);
}

.replyComposerCopy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.replyComposerCopy strong {
  color: #a8efff;
  font-size: 12px;
}

.replyComposerCopy span {
  overflow: hidden;
  color: var(--muted-strong);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 11px 12px 7px;
}

.composerButton {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
  border-radius: 12px;
}

.buttonIcon {
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  pointer-events: none;
}

.buttonIcon svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.buttonIcon.iconStop {
  display: none;
}

.buttonIcon.iconReady {
  display: none;
}

.buttonIcon .stopShape {
  fill: currentColor;
  stroke: none;
}

.composerButton.recording .iconDefault {
  display: none;
}

.composerButton.recording .iconStop {
  display: inline-grid;
}

.composerButton.ttsReady .iconDefault,
.composerButton.ttsReady .iconStop {
  display: none;
}

.composerButton.ttsReady .iconReady {
  display: inline-grid;
}

.composerButton.ttsReady {
  border-color: rgba(68, 219, 255, 0.52);
  background: rgba(68, 219, 255, 0.16);
  color: #a8efff;
}

.composerButton.recording {
  border-color: rgba(255, 107, 124, 0.45);
  background: rgba(255, 107, 124, 0.16);
  color: #ffb2bc;
  animation: recordingPulse 1.2s ease-in-out infinite;
}

@keyframes recordingPulse {
  50% {
    box-shadow: 0 0 0 6px rgba(255, 107, 124, 0.07);
  }
}

.msgBox {
  min-height: 42px;
  max-height: 130px;
  flex: 1;
  resize: none;
  line-height: 1.45;
}

.sendButton {
  min-width: 80px;
  min-height: 42px;
}

.composerFooter {
  display: flex;
  min-height: 28px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 0 13px 8px;
}

.composerMeta,
.sendStatus {
  padding: 0;
}

.sendStatus {
  color: #a7c0df;
  text-align: right;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  overflow-y: auto;
  background: rgba(1, 5, 11, 0.72);
  backdrop-filter: blur(16px);
}

.modalCard {
  width: min(540px, 100%);
  max-height: calc(100dvh - 36px);
  overflow: auto;
  border-radius: 24px;
  animation: modalIn 180ms ease-out both;
}

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

.modalHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.modalTitle {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.modalBody {
  padding: 18px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
}

.segmented .btn {
  min-height: 44px;
  padding: 8px;
  font-size: 11px;
}

.modalSection {
  margin-top: 17px;
  padding-top: 3px;
  border-top: 1px solid var(--border);
}

.modalSection .btnWide {
  margin-top: 12px;
}

.newGroupAvatarPicker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.035);
}

.newGroupAvatarActions {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
}

.newGroupAvatarActions .small {
  overflow: hidden;
  width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profileHero {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.035);
}

.profileAvatar {
  width: 58px;
  height: 58px;
  flex-basis: 58px;
  border-radius: 20px;
}

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

.profileIdentity span,
.profileIdentity strong {
  display: block;
}

.profileIdentity strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profilePreference {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 16px 0;
  padding: 14px;
  border: 1px solid rgba(126, 170, 224, 0.2);
  border-radius: 17px;
  background:
    linear-gradient(135deg, rgba(39, 215, 255, 0.07), rgba(123, 97, 255, 0.07)),
    rgba(255, 255, 255, 0.035);
}

.profilePreferenceCopy {
  min-width: 0;
}

.profilePreferenceCopy strong,
.profilePreferenceCopy span {
  display: block;
}

.profilePreferenceCopy strong {
  color: #f3f8ff;
  font-size: 14px;
  line-height: 1.35;
}

.profilePreferenceCopy span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.toggleSwitch {
  position: relative;
  width: 48px;
  height: 28px;
  flex: 0 0 48px;
  cursor: pointer;
}

.toggleSwitch input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.toggleSwitchTrack {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(174, 211, 255, 0.25);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.34);
  transition: border-color 160ms ease, background 160ms ease;
}

.toggleSwitchTrack::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #d8e8f9;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.32);
  content: "";
  transition: transform 160ms ease, background 160ms ease;
}

.toggleSwitch input:checked + .toggleSwitchTrack {
  border-color: rgba(68, 219, 255, 0.7);
  background: linear-gradient(135deg, #27d7ff, #7662ff);
}

.toggleSwitch input:checked + .toggleSwitchTrack::after {
  transform: translateX(20px);
  background: #fff;
}

.toggleSwitch input:focus-visible + .toggleSwitchTrack {
  outline: 3px solid rgba(68, 219, 255, 0.26);
  outline-offset: 3px;
}

[dir="rtl"] .toggleSwitchTrack::after {
  right: 3px;
  left: auto;
}

[dir="rtl"] .toggleSwitch input:checked + .toggleSwitchTrack::after {
  transform: translateX(-20px);
}

.profileCredits {
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid rgba(126, 170, 224, 0.2);
  border-radius: 17px;
  background:
    radial-gradient(circle at 10% 0%, rgba(39, 215, 255, 0.08), transparent 36%),
    rgba(3, 12, 24, 0.46);
}

.profileCreditsHead {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 13px;
  border-bottom: 1px solid rgba(126, 170, 224, 0.18);
  background: linear-gradient(90deg, rgba(33, 79, 151, 0.2), rgba(106, 71, 219, 0.14));
}

.profileCreditsHead h3 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #f3f8ff;
  font-size: 15px;
  font-weight: 820;
  letter-spacing: -0.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profilePlanBadge {
  max-width: 48%;
  padding: 5px 11px;
  overflow: hidden;
  flex: 0 0 auto;
  border: 1px solid rgba(93, 224, 255, 0.28);
  border-radius: 999px;
  background: rgba(39, 215, 255, 0.1);
  color: #a9f3ff;
  font-size: 11px;
  font-weight: 820;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profileCreditsBody {
  display: grid;
  gap: 9px;
  padding: 13px;
}

.profileCreditsCaption {
  margin: 0 1px 2px;
  color: var(--muted);
  font-size: 11px;
}

.profileQuota {
  --quota-color-start: #35d9ff;
  --quota-color-end: #4c8dff;
  padding: 11px 12px 12px;
  border: 1px solid rgba(174, 211, 255, 0.12);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.035);
}

.profileQuotaStt {
  --quota-color-start: #a9ff6f;
  --quota-color-end: #3ed39b;
}

.profileQuotaTts {
  --quota-color-start: #b69cff;
  --quota-color-end: #7b61ff;
}

.profileQuotaCalls {
  --quota-color-start: #ffc666;
  --quota-color-end: #ff7a72;
}

.profileQuotaHead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.profileQuotaHead span {
  min-width: 0;
  color: #eaf3ff;
  font-size: 11px;
  font-weight: 730;
  line-height: 1.35;
}

.profileQuotaHead strong {
  flex: 0 0 auto;
  color: #fff;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.profileQuotaTrack {
  position: relative;
  height: 8px;
  margin-top: 9px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.34);
}

.profileQuotaFill {
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--quota-color-start), var(--quota-color-end));
  box-shadow: 0 0 14px color-mix(in srgb, var(--quota-color-start) 58%, transparent);
  transition: width 320ms ease;
}

.divider {
  height: 1px;
  margin: 16px 0;
  background: var(--border);
}

.inlineField {
  display: flex;
  gap: 8px;
}

.membersList {
  display: flex;
  max-height: 300px;
  flex-direction: column;
  gap: 7px;
  margin-top: 8px;
  overflow: auto;
}

.memberRow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.03);
}

.msgMenu {
  position: fixed;
  z-index: 150;
  display: flex;
  gap: 6px;
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 16px);
  padding: 7px;
  overflow: auto;
  flex-wrap: wrap;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: rgba(9, 21, 37, 0.98);
  box-shadow: var(--shadow);
  overscroll-behavior: contain;
}

.msgMenu .btn {
  min-height: 36px;
  padding: 7px 10px;
  white-space: normal;
  font-size: 11px;
}

@media (max-width: 680px) {
  .msgMenu {
    display: grid;
    width: calc(100vw - 16px);
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .msgMenu .btn {
    width: 100%;
    min-width: 0;
  }
}

.callCard {
  width: min(960px, 100%);
}

.callDestinationCard {
  width: min(520px, 100%);
}

.callDestinationContext {
  margin-bottom: 13px;
  line-height: 1.45;
}

.callDestinationOptions {
  display: grid;
  gap: 9px;
}

.callDestinationOption {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  width: 100%;
  min-height: 74px;
  gap: 11px;
  padding: 12px 14px;
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(4, 13, 24, 0.78);
  color: var(--text);
  font: inherit;
  text-align: left;
}

.callDestinationOption:not(:disabled):hover {
  border-color: rgba(36, 217, 255, 0.38);
  background: linear-gradient(90deg, rgba(36, 217, 255, 0.10), rgba(138, 101, 255, 0.08));
  transform: translateY(-1px);
}

.callDestinationOption:focus-visible {
  outline: 3px solid rgba(36, 217, 255, 0.13);
  outline-offset: 2px;
}

.callDestinationOption:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.callDestinationIcon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 13px;
  background: rgba(36, 217, 255, 0.08);
  color: var(--accent);
  font-size: 25px;
  line-height: 1;
}

.callDestinationOption .itemMain {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.callDestinationOption .itemName {
  font-size: 14px;
}

.callDestinationOption .itemPreview {
  color: var(--muted);
  font-size: 12px;
}

.callDestinationActions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

#callDestinationStatus:empty {
  display: none;
}

.callVideos {
  position: relative;
  min-height: 360px;
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: #02060c;
}

.callVideos video {
  width: 100%;
  height: min(58vh, 540px);
  object-fit: cover;
}

#callLocalVideo {
  position: absolute;
  z-index: 3;
  right: 15px;
  bottom: 15px;
  width: min(220px, 28%);
  height: auto;
  min-height: 120px;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--border-strong);
  border-radius: 15px;
  background: #08111e;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.38);
}

.callVideos.is-local-primary #callLocalVideo {
  position: relative;
  z-index: 1;
  inset: auto;
  display: block;
  width: 100%;
  height: min(58vh, 540px);
  min-height: 0;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  background: #02060c;
  box-shadow: none;
}

.callVideos.is-local-primary #callRemoteVideo {
  position: absolute;
  z-index: 3;
  right: 15px;
  bottom: 15px;
  width: min(220px, 28%);
  height: auto;
  min-height: 120px;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--border-strong);
  border-radius: 15px;
  background: #08111e;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.38);
}

.callTranslationPanel {
  position: absolute;
  z-index: 2;
  right: calc(min(220px, 28%) + 30px);
  bottom: 14px;
  left: 14px;
  max-height: calc(100% - 28px);
  padding: 14px;
  overflow: auto;
  border: 1px solid rgba(78, 203, 255, 0.22);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(11, 33, 54, 0.94), rgba(6, 17, 31, 0.97));
  backdrop-filter: blur(12px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.3);
}

.callTranslationPanel.is-off {
  border-color: var(--border);
  background: rgba(0, 0, 0, 0.16);
}

.callTranslationHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.callTranslationHead strong,
.callTranslationLanguages {
  display: block;
}

.callTranslationHead strong {
  font-size: 13px;
}

.callTranslationLanguages {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.callTranslationToggle {
  min-width: 88px;
}

.callTranslationToggle[aria-pressed="true"] {
  border-color: rgba(53, 227, 162, 0.3);
  background: rgba(53, 227, 162, 0.11);
  color: #9bf0ce;
}

.callTranslationMessage {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.callTranslationMessage.ok {
  color: #9bf0ce;
}

.callTranslationMessage.warn {
  color: #ffe1a4;
}

.callCaptionOriginal,
.callCaptionTranslated {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.callCaptionOriginal {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 13px;
}

.callCaptionTranslated {
  border: 1px solid rgba(78, 203, 255, 0.2);
  background: rgba(78, 203, 255, 0.08);
  color: #bdeeff;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.45;
}

.callTranslationOptions {
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
}

.callTranslationOptions label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}

.callTranslationOptions input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

@media (max-width: 1180px) {
  .topMeta {
    display: none;
  }

  .companionBadge {
    display: none;
  }

  .loginShell {
    gap: 44px;
  }

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

  .featureCard {
    align-items: center;
  }

  .featureCard div > span {
    display: none;
  }
}

@media (max-width: 900px) {
  .loginShell {
    grid-template-columns: 1fr;
  }

  .loginIntro {
    max-width: none;
    text-align: center;
  }

  .eyebrow {
    margin-inline: auto;
  }

  .loginLead {
    margin-inline: auto;
  }

  .featureGrid {
    grid-template-columns: repeat(3, 1fr);
    text-align: left;
  }

  .howTo {
    text-align: left;
  }

  .loginCard {
    width: min(500px, 100%);
    margin: auto;
  }

  .layout {
    height: auto;
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .sidebar {
    height: 42dvh;
    min-height: 340px;
  }

  .chat {
    height: 72dvh;
    min-height: 540px;
  }
}

@media (max-width: 680px) {
  :root {
    --header-height: 64px;
  }

  .top {
    gap: 10px;
    padding-inline: 12px;
  }

  .brandLogo {
    width: 40px;
    height: 40px;
  }

  .brandCopy .small {
    display: none;
  }

  .topActions {
    gap: 5px;
  }

  body.app-connected .topActions .btn {
    display: none;
  }

  .smallSelect {
    min-width: 62px;
  }

  .loginView {
    padding: 28px 14px 42px;
  }

  h1 {
    font-size: clamp(38px, 12vw, 52px);
  }

  .loginLead {
    font-size: 16px;
  }

  .featureGrid,
  .howTo {
    grid-template-columns: 1fr;
  }

  .featureCard div > span {
    display: block;
  }

  .howTo {
    gap: 10px;
  }

  .appView {
    padding: 8px;
  }

  .sidebar,
  .chat {
    border-radius: 17px;
  }

  .chatHeader {
    min-height: 65px;
    padding: 10px;
  }

  .chatHeadRight {
    gap: 5px;
  }

  .chatHeadRight .iconButton {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .headerGroupManage {
    width: 36px;
    min-width: 36px;
    padding: 0;
  }

  .headerGroupManageLabel {
    display: none;
  }

  .messages {
    padding: 14px 10px;
  }

  .latestMessageButton {
    right: 10px;
    bottom: 10px;
    max-width: calc(100% - 20px);
  }

  .bubble {
    max-width: 88%;
  }

  .composer {
    gap: 5px;
    padding-inline: 8px;
  }

  .composerButton {
    display: none;
  }

  #btnAttach {
    display: inline-flex;
  }

  .sendButton {
    min-width: 66px;
    padding-inline: 12px;
  }

  .composerMeta {
    display: none;
  }

  .composerFooter {
    justify-content: flex-end;
  }

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

  .profileHero {
    flex-wrap: wrap;
  }

  .newGroupAvatarPicker {
    align-items: flex-start;
  }

  .newGroupAvatarActions .btn {
    width: 100%;
  }

  .profileHero .btn {
    width: 100%;
  }

  .profileCreditsHead {
    min-height: 50px;
  }

  .profileQuotaHead {
    align-items: flex-start;
  }

  .profileQuotaHead span {
    max-width: 62%;
  }

  .callTranslationHead {
    align-items: flex-start;
  }

  #callLocalVideo {
    top: 10px;
    right: 10px;
    bottom: auto;
    width: min(120px, 32%);
    min-height: 80px;
  }

  .callVideos.is-local-primary #callLocalVideo {
    inset: auto;
    width: 100%;
    height: min(58vh, 540px);
    min-height: 0;
  }

  .callVideos.is-local-primary #callRemoteVideo {
    top: 10px;
    right: 10px;
    bottom: auto;
    width: min(120px, 32%);
    min-height: 80px;
  }

  .callTranslationPanel {
    right: 10px;
    bottom: 10px;
    left: 10px;
    max-height: 62%;
    padding: 12px;
  }
}

/* OneVoice expressions: emoji, GIF, stickers and complete reactions */
.expressionButtonGlyph {
  font-size: 22px;
  line-height: 1;
}

.expressionPanel {
  display: flex;
  height: min(520px, 64dvh);
  max-height: min(520px, 64dvh);
  padding: 12px;
  overflow: hidden;
  flex-direction: column;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(165deg, rgba(10, 27, 48, 0.98), rgba(6, 17, 32, 0.98));
}

.expressionPanelHead,
.expressionSearchRow,
.expressionFilters,
.expressionHint,
.expressionSelection,
.expressionPanelFoot,
.expressionMore,
.reactionDetailsHead,
.reactionDetailGroupHead {
  flex: 0 0 auto;
}

.expressionPanelHead,
.expressionFilters,
.expressionSelection,
.expressionPanelFoot,
.reactionDetailsHead,
.reactionDetailGroupHead {
  display: flex;
  align-items: center;
  gap: 8px;
}

.expressionPanelHead {
  justify-content: space-between;
  margin-bottom: 10px;
}

.expressionTabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(0, 6, 15, 0.36);
}

.expressionTab,
.expressionFilter {
  min-height: 34px;
  padding: 6px 12px;
  border: 0;
  border-radius: 10px;
  color: var(--muted-strong);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.expressionTab.active,
.expressionFilter.active {
  color: #e9fbff;
  background: linear-gradient(135deg, rgba(36, 217, 255, 0.2), rgba(57, 119, 255, 0.22));
  box-shadow: inset 0 0 0 1px rgba(83, 221, 255, 0.22);
}

.expressionSearchRow {
  margin-bottom: 8px;
}

.expressionSearchRow .search {
  width: 100%;
}

.expressionFilters {
  margin-bottom: 8px;
  overflow-x: auto;
}

.expressionHint {
  margin: 0 2px 8px;
  padding: 7px 10px;
  border: 1px solid rgba(36, 217, 255, 0.16);
  border-radius: 10px;
  color: #c9f7ff;
  background: rgba(36, 217, 255, 0.07);
  font-size: 12px;
  font-weight: 800;
}

.expressionFilter {
  flex: 0 0 auto;
  min-height: 31px;
  padding: 5px 10px;
  border: 1px solid var(--border);
}

.expressionPack {
  min-width: 160px;
  min-height: 32px;
  margin-inline-start: auto;
  padding: 4px 28px 4px 9px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  background: var(--surface-solid);
}

.expressionGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
  gap: 8px;
  min-height: 0;
  padding: 2px;
  overflow: auto;
  flex: 1 1 auto;
  align-content: start;
  overscroll-behavior: contain;
}

.expressionGrid[aria-busy="true"] {
  opacity: 0.55;
}

.expressionEmoji,
.reactionModalOption {
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 12px;
  color: inherit;
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  font-size: 26px;
}

.expressionEmoji {
  min-height: 54px;
}

.expressionEmoji:hover,
.reactionModalOption:hover,
.expressionItemChoose:hover {
  border-color: rgba(36, 217, 255, 0.3);
  background: rgba(36, 217, 255, 0.09);
}

.expressionItem {
  position: relative;
  min-height: 124px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.expressionItem.selected {
  border-color: #48dcff;
  background: rgba(36, 217, 255, 0.13);
  box-shadow: inset 0 0 0 2px rgba(72, 220, 255, 0.62), 0 0 0 2px rgba(72, 220, 255, 0.12);
}

.expressionItem--sticker {
  background: radial-gradient(circle, rgba(71, 128, 204, 0.14), transparent 70%);
}

.expressionItemChoose {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 124px;
  padding: 6px;
  grid-template-rows: minmax(84px, 1fr) auto;
  gap: 5px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: inherit;
  color: inherit;
  background: transparent;
  cursor: pointer;
}

.expressionItem img {
  display: block;
  width: 100%;
  height: 92px;
  object-fit: contain;
}

.expressionItemLabel {
  width: 100%;
  padding: 0 4px 2px;
  overflow: hidden;
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.25;
  text-align: start;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expressionSelectedMark {
  position: absolute;
  top: 7px;
  left: 7px;
  z-index: 2;
  display: none;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 2px solid white;
  border-radius: 50%;
  color: #042037;
  background: #5be2ff;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.35);
  font-size: 16px;
  font-weight: 950;
}

.expressionItem.selected .expressionSelectedMark {
  display: grid;
}

.expressionItem img.hasError {
  opacity: 0.25;
}

.expressionFavorite {
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  width: 31px;
  height: 31px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: white;
  background: rgba(2, 8, 17, 0.75);
  cursor: pointer;
  font-size: 17px;
}

.expressionFavorite.active {
  color: #ffd86f;
  border-color: rgba(255, 216, 111, 0.48);
}

.expressionEmpty {
  min-height: 86px;
  padding: 24px 12px;
  color: var(--muted);
  text-align: center;
}

.expressionMore {
  display: block;
  min-width: 150px;
  margin: 8px auto 0;
}

.messageQuote {
  display: flex;
  width: 100%;
  min-width: 170px;
  margin: 0 0 8px;
  padding: 7px 9px;
  overflow: hidden;
  flex-direction: column;
  border: 0;
  border-inline-start: 3px solid rgba(118, 230, 255, 0.78);
  border-radius: 8px;
  color: inherit;
  background: rgba(0, 8, 19, 0.3);
  cursor: pointer;
  text-align: start;
}

.messageQuote strong {
  color: #a8efff;
  font-size: 11px;
}

.messageQuote span {
  overflow: hidden;
  color: rgba(231, 241, 255, 0.78);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.replyTargetHighlight .bubble {
  animation: replyTargetPulse 1.25s ease-out;
}

@keyframes replyTargetPulse {
  0%, 45% { box-shadow: 0 0 0 3px rgba(36, 217, 255, 0.48), 0 8px 24px rgba(0, 0, 0, 0.14); }
  100% { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14); }
}

.expressionSelection {
  margin-top: 9px;
  padding: 9px;
  border: 1px solid rgba(72, 220, 255, 0.48);
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(36, 217, 255, 0.13), rgba(57, 119, 255, 0.11));
  box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.18);
}

.expressionSelectionPreview {
  display: grid;
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  place-items: center;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(0, 5, 12, 0.5);
}

.expressionSelectedImage {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.expressionSelectionCopy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.expressionSelectionCopy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expressionSelectionActions {
  display: flex;
  flex: 0 0 auto;
  gap: 7px;
}

.expressionSelectionActions .btn {
  min-height: 38px;
}

.expressionPanelFoot {
  min-height: 24px;
  justify-content: space-between;
  margin-top: 6px;
}

.expressionAttribution {
  color: #a8efff;
  font-size: 11px;
}

.reactionModalCard {
  width: min(590px, 100%);
}

.reactionModalGrid {
  display: grid;
  grid-template-columns: repeat(8, minmax(42px, 1fr));
  gap: 6px;
  max-height: 280px;
  margin-top: 10px;
  overflow-y: auto;
}

.reactionModalOption {
  min-height: 45px;
}

.reactionDetails {
  margin-top: 10px;
}

.reactionDetailsHead,
.reactionDetailGroupHead {
  justify-content: space-between;
}

.reactionDetailsList {
  display: grid;
  gap: 10px;
  max-height: 380px;
  margin-top: 10px;
  overflow-y: auto;
}

.reactionDetailGroup {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.reactionDetailGroup.focused {
  border-color: rgba(36, 217, 255, 0.35);
}

.reactionParticipant {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(174, 211, 255, 0.08);
}

.reactionParticipant .avatar {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
}

.reactionParticipantCopy {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.bubble--sticker {
  padding: 4px;
  border-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
}

.mediaCard--sticker {
  width: min(250px, 72vw);
  min-width: 0;
}

.mediaCard--sticker .chatMediaPreview {
  min-height: 100px;
  margin: 0;
  border: 0;
  background: transparent;
}

.mediaCard--sticker .chatMediaImage {
  max-height: 250px;
  min-height: 90px;
  background: transparent;
}

.mediaCard--gif {
  width: min(360px, 78vw);
  min-width: 0;
}

.mediaCard--gif .chatMediaPreview {
  margin-bottom: 0;
}

@media (max-width: 680px) {
  .expressionPanel {
    height: min(560px, 72dvh);
    max-height: min(560px, 72dvh);
    padding: 9px;
  }

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

  .expressionSelection {
    flex-wrap: wrap;
  }

  .expressionSelectionPreview {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
  }

  .expressionSelectionActions {
    width: 100%;
  }

  .expressionSelectionActions .btn {
    flex: 1;
  }

  .expressionTabs {
    flex: 1;
  }

  .expressionTab {
    flex: 1;
    padding-inline: 8px;
  }

  .expressionPack {
    min-width: 140px;
  }

  .reactionModalGrid {
    grid-template-columns: repeat(6, minmax(38px, 1fr));
  }

  .composer {
    gap: 5px;
  }

  .composerButton {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .expressionPanel *,
  .reactionModal * {
    scroll-behavior: auto !important;
  }
}

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


/* Android parity v1: local attachment previews */
.uploadItem {
  min-width: 300px;
  max-width: 380px;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: stretch;
}

.uploadItemPreview {
  position: relative;
  display: grid;
  width: 92px;
  min-height: 78px;
  place-items: center;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(4, 13, 24, 0.86);
  cursor: pointer;
}

.uploadItemPreview img,
.uploadItemPreview video,
.uploadItemPreview object {
  width: 100%;
  height: 100%;
  min-height: 78px;
  max-height: 96px;
  object-fit: cover;
  border: 0;
}

.uploadItemPreview.audio {
  grid-template-rows: 1fr auto;
  padding: 6px;
}

.uploadItemPreview.audio audio {
  width: 82px;
  height: 28px;
}

.uploadItemPreview .uploadItemIcon {
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 25px;
  height: 25px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(4, 13, 24, 0.86);
  backdrop-filter: blur(8px);
}

.uploadDocumentBadge {
  display: grid;
  min-width: 54px;
  min-height: 44px;
  padding: 7px;
  place-items: center;
  border: 1px solid rgba(106, 174, 255, 0.24);
  border-radius: 9px;
  background: linear-gradient(145deg, rgba(57, 119, 255, 0.18), rgba(133, 84, 255, 0.13));
  color: #dceaff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.uploadTextSnippet {
  width: 100%;
  max-height: 42px;
  margin: 0;
  padding: 4px;
  overflow: hidden;
  color: var(--muted);
  font: 8px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: normal;
}

.uploadItemType {
  margin-top: 2px;
  overflow: hidden;
  color: #8da4bf;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uploadItem.done .uploadItemPreview .uploadItemIcon {
  background: rgba(13, 58, 48, 0.9);
  color: var(--ok);
}

.uploadItem.error .uploadItemPreview .uploadItemIcon {
  background: rgba(68, 22, 34, 0.92);
  color: var(--err);
}

/* Forward picker */
.forwardCard {
  width: min(560px, calc(100vw - 28px));
  overflow: hidden;
}

.forwardCard .modalBody {
  display: grid;
  gap: 12px;
}

.forwardCard .search {
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: rgba(2, 9, 18, 0.52);
  color: var(--text);
  box-shadow: none;
}

.forwardCard .search:focus {
  border-color: rgba(36, 217, 255, 0.5);
  background: rgba(3, 13, 26, 0.72);
  box-shadow: 0 0 0 3px rgba(36, 217, 255, 0.08);
}

.forwardPreview {
  margin: 0;
  padding: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  color: #dceaff;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.forwardList {
  display: grid;
  max-height: 390px;
  gap: 6px;
  padding: 7px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: rgba(2, 9, 18, 0.34);
}

.forwardDestination {
  width: 100%;
  min-height: 60px;
  margin: 0;
  padding: 9px 11px;
  appearance: none;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
}

.forwardDestination:hover {
  border-color: rgba(36, 217, 255, 0.14);
  background: linear-gradient(90deg, rgba(36, 217, 255, 0.075), rgba(138, 101, 255, 0.06));
  transform: translateX(2px);
}

.forwardDestination:focus-visible {
  border-color: rgba(36, 217, 255, 0.42);
  outline: 3px solid rgba(36, 217, 255, 0.10);
  outline-offset: 1px;
}

.forwardDestination:disabled {
  cursor: wait;
}

.forwardDestination.busy {
  border-color: rgba(36, 217, 255, 0.22);
  background: linear-gradient(90deg, rgba(36, 217, 255, 0.10), rgba(138, 101, 255, 0.08));
  opacity: 0.82;
}

.forwardDestination .itemMain {
  text-align: left;
}

.forwardDestination .itemName {
  color: var(--text);
  font-size: 13px;
}

.forwardDestination .itemPreview {
  color: var(--muted);
}

#forwardStatus {
  margin: 0;
}

#forwardStatus:empty {
  display: none;
}

.forwardEmpty {
  padding: 20px;
  text-align: center;
}

@media (max-width: 620px) {
  .forwardCard .modalHead {
    padding: 14px 15px;
  }

  .forwardCard .modalBody {
    padding: 14px;
  }

  .forwardList {
    max-height: min(390px, 48dvh);
  }
}

/* Local browser call history */
.callHistoryList {
  display: grid;
  max-height: 430px;
  gap: 8px;
  overflow-y: auto;
}

.callHistoryRow {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.callHistoryIcon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: rgba(57, 119, 255, 0.12);
  font-size: 19px;
}

.callHistoryMain {
  min-width: 0;
}

.callHistoryEmpty {
  padding: 28px 12px;
  text-align: center;
}

@media (max-width: 620px) {
  .uploadItem {
    min-width: 260px;
    max-width: 310px;
    grid-template-columns: 78px minmax(0, 1fr);
  }
  .uploadItemPreview {
    width: 78px;
  }
}

/* Android parity v2: persistent composer attachment staging */
.uploadQueue {
  display: block;
  padding: 0;
  overflow: hidden;
  border-top: 1px solid rgba(106, 174, 255, 0.2);
  background: linear-gradient(180deg, rgba(9, 24, 43, 0.98), rgba(4, 13, 24, 0.94));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.uploadQueueHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px 7px;
}

.uploadQueueHead > div {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 8px;
}

.uploadQueueHead strong {
  color: #eaf3ff;
  font-size: 12px;
}

.uploadQueueItems {
  display: flex;
  gap: 9px;
  padding: 2px 12px 11px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.compactButton {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 10px;
}

.uploadItem {
  position: relative;
  min-width: 330px;
  max-width: 410px;
  grid-template-columns: 92px minmax(0, 1fr) 30px;
  align-items: stretch;
  border-color: rgba(106, 174, 255, 0.2);
  background: rgba(255, 255, 255, 0.055);
}

.uploadItem.pending {
  box-shadow: 0 0 0 1px rgba(57, 119, 255, 0.06), 0 12px 28px rgba(0, 0, 0, 0.14);
}

.uploadItem.uploading {
  border-color: rgba(80, 198, 255, 0.35);
}

.uploadRemoveButton {
  align-self: start;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.045);
  color: #dceaff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.uploadRemoveButton:hover,
.uploadRemoveButton:focus-visible {
  border-color: rgba(255, 107, 124, 0.4);
  background: rgba(255, 107, 124, 0.1);
  color: #ffdbe0;
  outline: none;
}

.uploadRemoveButton:disabled {
  cursor: wait;
  opacity: 0.4;
}

.uploadItem.pending .uploadProgress {
  opacity: 0.35;
}

.sendButton.hasAttachments {
  box-shadow: 0 0 0 1px rgba(101, 218, 255, 0.22), 0 0 24px rgba(57, 119, 255, 0.2);
}

#btnCallHistoryQuick {
  flex: 0 0 auto;
  border-color: rgba(106, 174, 255, 0.2);
  color: #cfe3ff;
}

@media (max-width: 620px) {
  .uploadQueueHead {
    align-items: flex-start;
  }

  .uploadQueueHead > div {
    flex-direction: column;
    gap: 1px;
  }

  .uploadItem {
    min-width: 285px;
    max-width: 330px;
    grid-template-columns: 78px minmax(0, 1fr) 28px;
  }

  .uploadRemoveButton {
    width: 26px;
    height: 26px;
  }
}

/* Android parity v3: inline media previews inside chat messages */
.mediaCard {
  width: min(430px, 100%);
  min-width: min(280px, 100%);
  overflow: hidden;
}

.chatMediaPreview {
  position: relative;
  width: 100%;
  margin-bottom: 10px;
  overflow: hidden;
  border: 1px solid rgba(174, 211, 255, 0.14);
  border-radius: 11px;
  background: rgba(0, 7, 16, 0.58);
}

.chatMediaPreview--image,
.chatMediaPreview--video {
  min-height: 150px;
  display: grid;
  place-items: center;
}

.chatMediaImage,
.chatMediaVideo {
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: 430px;
  border: 0;
  object-fit: contain;
  background: rgba(0, 5, 12, 0.82);
}

.chatMediaImage {
  min-height: 120px;
  cursor: zoom-in;
}

.chatMediaVideo {
  min-height: 220px;
}

.chatMediaAudio {
  display: block;
  width: calc(100% - 18px);
  margin: 9px;
}

.chatPdfShell {
  position: relative;
  height: 360px;
  background: #f3f5f8;
}

.chatPdfFrame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.chatPdfLoading {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  padding: 18px;
  color: rgba(221, 236, 255, 0.78);
  background: rgba(5, 16, 30, 0.96);
  font-weight: 750;
}

.chatTextPreview {
  max-height: 170px;
  overflow: auto;
  padding: 14px;
  color: rgba(234, 244, 255, 0.88);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chatTextPreview.hasError {
  color: rgba(255, 211, 211, 0.82);
}

.chatDocumentPreview {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 94px;
  padding: 14px;
}

.chatDocumentIcon {
  display: grid;
  place-items: center;
  flex: 0 0 58px;
  width: 58px;
  height: 68px;
  border: 1px solid rgba(156, 238, 255, 0.26);
  border-radius: 10px;
  color: #b8f3ff;
  background: linear-gradient(160deg, rgba(56, 117, 195, 0.38), rgba(36, 58, 105, 0.55));
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.chatDocumentText {
  color: rgba(210, 226, 246, 0.72);
  font-size: 12px;
  line-height: 1.45;
}

.chatMediaDetails {
  min-width: 0;
}

.chatMediaTitle {
  color: #f2f7ff;
  font-weight: 900;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.chatMediaMeta {
  margin-top: 4px;
  color: rgba(191, 210, 234, 0.68);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.chatMediaFallback {
  display: grid;
  place-items: center;
  gap: 8px;
  width: 100%;
  min-height: 130px;
  padding: 18px;
  text-align: center;
}

.chatMediaFallbackIcon {
  display: grid;
  place-items: center;
  min-width: 54px;
  min-height: 54px;
  border-radius: 13px;
  color: #b8f3ff;
  background: rgba(78, 133, 220, 0.2);
  font-weight: 900;
}

.chatMediaFallbackText {
  color: rgba(210, 226, 246, 0.72);
  font-size: 12px;
}

.mediaCard .mediaActions {
  padding-top: 2px;
}

@media (max-width: 680px) {
  .mediaCard {
    width: min(100%, 360px);
    min-width: 0;
  }

  .chatMediaVideo {
    min-height: 170px;
  }

  .chatPdfShell {
    height: 290px;
  }
}

/* Keep dedicated GIF/sticker presentation after legacy media parity rules. */
.bubble--sticker {
  padding: 4px;
  border-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
}

.mediaCard.mediaCard--sticker {
  width: min(250px, 72vw);
  min-width: 0;
}

.mediaCard.mediaCard--gif {
  width: min(360px, 78vw);
  min-width: 0;
}

.mediaCard--sticker .chatMediaPreview,
.mediaCard--gif .chatMediaPreview {
  margin-bottom: 0;
}

.mediaCard--sticker .chatMediaPreview {
  min-height: 100px;
  border: 0;
  background: transparent;
}

.mediaCard--sticker .chatMediaImage {
  max-height: 250px;
  min-height: 90px;
  background: transparent;
}


/* =========================================================
   Chiamata di gruppo (mesh) — web/group-call.js
   Griglia adattiva: il numero di colonne segue i partecipanti,
   senza breakpoint fissi e senza JS di layout.
   ========================================================= */

.groupCallCard {
  width: min(1100px, 100%);
}

.groupCallGrid {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-content: start;
  max-height: min(62vh, 620px);
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: #02060c;
}

.groupCallGrid:empty {
  min-height: 220px;
}

.groupTile {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 15px;
  background: #08111e;
  aspect-ratio: 4 / 3;
}

.groupTile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #02060c;
}

.groupTileLocal {
  outline: 2px solid var(--border-strong);
  outline-offset: -2px;
}

/* Partecipante non piu' raggiungibile: connessione caduta oppure uscito dalla
   chiamata. Il riquadro resta al suo posto e si spegne, cosi' si vede CHI e'
   sparito invece di ritrovarsi la griglia cambiata senza spiegazione. */
.groupTileOffline video {
  filter: grayscale(1) brightness(0.45);
}

.groupTileBadge {
  position: absolute;
  z-index: 3;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(2, 6, 12, 0.82);
  color: #f2f5f9;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.02em;
  white-space: nowrap;
  pointer-events: none;
}

.groupTileName {
  position: absolute;
  z-index: 2;
  left: 8px;
  bottom: 8px;
  max-width: calc(100% - 16px);
  padding: 3px 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(2, 6, 12, 0.72);
  color: #fff;
  font-size: 12px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.groupCallTranslationPanel {
  /* Nel 1:1 questo pannello e' sovrapposto al video (position: absolute con
     left/bottom/right). Nella chiamata di gruppo sta invece nel flusso della
     colonna: senza questo ripristino finirebbe sopra i pulsanti. */
  position: static;
  inset: auto;
  z-index: auto;
  max-height: none;
  margin-top: 12px;
  backdrop-filter: none;
}

/* Stessa regola con due classi: cosi' vince su .callTranslationPanel per
   specificita' e non solo perche' viene dopo nel file. Con un solo nome di
   classe le due regole pareggiavano e bastava un cambio d'ordine per far
   tornare il pannello sopra i pulsanti. */
.groupCallCard .callTranslationPanel,
.modalCard .groupCallTranslationPanel {
  position: static;
  inset: auto;
  z-index: auto;
  max-height: none;
  backdrop-filter: none;
}

/* Su schermi stretti una colonna sola: due riquadri affiancati
   diventerebbero illeggibili. */
@media (max-width: 560px) {
  .groupCallGrid {
    grid-template-columns: 1fr;
    max-height: min(56vh, 480px);
  }
}

/* Pannello "aggiungi partecipanti" della chiamata di gruppo */
.groupAddPanel {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
}

.groupAddTitle {
  margin-bottom: 10px;
  font-weight: 600;
}

.groupAddList {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.groupAddRow {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  text-align: left;
}

.groupAddRow span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.groupAddRow input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
}

.groupAddStatus {
  min-height: 18px;
  margin-top: 8px;
  font-size: 13px;
  opacity: 0.8;
}

.groupAddActions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 10px;
}

/* Chiamata di gruppo in arrivo */
.groupRingCard {
  width: min(420px, 100%);
}

.groupRingBody {
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
  padding: 26px 20px 22px;
}

.groupRingIcon {
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  font-size: 42px;
}

.groupRingTitle {
  font-size: 20px;
  font-weight: 700;
}

.groupRingSubtitle {
  font-size: 14px;
}

.groupRingActions {
  display: flex;
  gap: 12px;
  justify-content: center;
  width: 100%;
  margin-top: 14px;
}

.groupRingActions .btn {
  min-width: 128px;
}

/* =========================================================
   Scelta dei partecipanti prima di chiamare
   Righe a griglia con colonne esplicite: cosi' il nome resta
   a sinistra e leggibile, senza dipendere da stili ereditati.
   ========================================================= */

.groupPickCard {
  width: min(460px, 100%);
}

.groupPickList {
  display: grid;
  gap: 6px;
  max-height: min(52vh, 420px);
  overflow-y: auto;
  padding: 4px;
  margin-bottom: 12px;
}

.groupPickRow {
  display: grid;
  grid-template-columns: 20px 34px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  text-align: left;
}

.groupPickRow:hover {
  background: rgba(255, 255, 255, 0.08);
}

.groupPickCheck {
  width: 18px;
  height: 18px;
  margin: 0;
}

.groupPickAvatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  font-size: 14px;
  font-weight: 700;
}

.groupPickName {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  font-size: 15px;
}

.groupPickCount {
  font-size: 13px;
  margin-bottom: 12px;
}

.groupPickActions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.groupPickActions .btn {
  min-width: 120px;
}

.groupPickActions .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Barra dei comandi della chiamata di gruppo: su schermi stretti i pulsanti
   vanno a capo invece di uscire dalla finestra. */
.groupCallCard .callActions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.groupCallCard .callActions .btn {
  flex: 0 1 auto;
}

/* Scelta di come ricevere la traduzione: testo, voce o entrambe */
.groupTrMode {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.groupTrModeLabel {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.7;
}

.groupTrOption {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
  font-size: 13px;
  cursor: pointer;
}

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

.groupTrOption.isSelected {
  border-color: rgba(78, 203, 255, 0.6);
  background: rgba(78, 203, 255, 0.18);
  font-weight: 600;
}
