:root {
  color-scheme: dark;
  --bg: #020503;
  --panel: #07110b;
  --panel-2: #0b1a10;
  --line: #24496b;
  --text: #e6f4e8;
  --muted: #9fba9f;
  --accent: #75baff;
  --chat-text-size: 17px;
}

:root[data-chat-text-size="small"] {
  --chat-text-size: 15px;
}

:root[data-chat-text-size="large"] {
  --chat-text-size: 20px;
}

:root[data-chat-text-size="extra-large"] {
  --chat-text-size: 23px;
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

[hidden] {
  display: none !important;
}

body {
  width: 100%;
  max-width: 100%;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.contact-invite-keyboard-open {
  overflow-y: auto;
  height: auto;
  min-height: 100%;
}

body.chat-active {
  height: 100dvh;
  overflow: hidden;
}

body.app-active {
  height: 100dvh;
  overflow: hidden;
}

body.app-active .shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  height: 100dvh;
  padding: 12px 0;
}

body.app-active .hero {
  margin: 0;
}

body.app-active .app-panel:not(.chat-open) {
  height: 100%;
  min-height: 0;
  margin: 0;
}

body.app-active .app-panel:not(.chat-open) .app-view {
  min-height: 0;
  padding-bottom: max(104px, calc(88px + env(safe-area-inset-bottom)));
  scroll-padding-bottom: max(104px, calc(88px + env(safe-area-inset-bottom)));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

body.app-active .app-panel:not(.chat-open) .bottom-nav {
  position: fixed;
  z-index: 70;
  right: 0;
  bottom: 0;
  left: 0;
  box-sizing: border-box;
  height: calc(78px + env(safe-area-inset-bottom));
  min-height: calc(78px + env(safe-area-inset-bottom));
  max-height: calc(78px + env(safe-area-inset-bottom));
  align-items: center;
  overflow: hidden;
}

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

.shell {
  width: min(960px, calc(100% - 32px));
  max-width: 100%;
  min-width: 0;
  margin: 0 auto;
  padding: 32px 0;
}

.hero,
.panel,
.app-panel {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), #030805);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 16px;
}

#contact-invite-panel {
  max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.app-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  min-height: min(720px, calc(100vh - 64px));
  padding: 0;
  overflow: hidden;
}

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

.app-boot-screen {
  display: grid;
  min-height: 180px;
  place-items: center;
}

.app-boot-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-boot-indicator i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
  animation: app-boot-pulse 900ms ease-in-out infinite;
}

.app-boot-indicator i:nth-child(2) { animation-delay: 120ms; }
.app-boot-indicator i:nth-child(3) { animation-delay: 240ms; }

@keyframes app-boot-pulse {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-4px); }
}

.hero h1 {
  color: var(--accent);
  margin-bottom: 0;
}

.hero .app-brand {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.app-brand img {
  width: 32px;
  height: 40px;
  object-fit: contain;
}

.app-brand span {
  color: var(--text);
}

.language-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  white-space: nowrap;
  font-size: 0;
}

.language-switcher select {
  width: 68px;
  min-width: 68px;
  padding: 8px 10px;
  font-size: 13px;
}

select {
  border: 1px solid #255273;
  border-radius: 6px;
  background: #020503;
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}

h1,
h2,
p {
  margin-top: 0;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

label {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  color: var(--muted);
}

input {
  width: 100%;
  border: 1px solid #255273;
  border-radius: 6px;
  background: #020503;
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid #255273;
  border-radius: 6px;
  background: #020503;
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
}

button {
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  padding: 12px 16px;
  font: inherit;
  font-weight: 700;
}

#welcome-panel,
#login-panel {
  max-width: 640px;
  margin-right: auto;
  margin-left: auto;
}

#welcome-panel h2,
#login-panel h2 {
  margin-bottom: 22px;
}

.first-start-actions {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.first-start-actions button {
  width: 100%;
  min-height: 52px;
}

.signup-actions {
  display: grid;
  gap: 10px;
}

.signup-actions button {
  width: 100%;
}

.login-actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

#login-button {
  width: 100%;
  min-height: 52px;
  background: #174d78;
  color: var(--text);
  border-color: var(--accent);
}

.login-options-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 2px;
  border: 0;
  border-top: 1px solid rgba(36, 73, 107, 0.72);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}

.login-options-chevron {
  display: inline-block;
  color: var(--accent);
  font-size: 20px;
  line-height: 1;
  transition: transform 160ms ease;
}

.login-options-toggle[aria-expanded="true"] .login-options-chevron {
  transform: rotate(180deg);
}

.login-options {
  display: grid;
  gap: 8px;
}

.login-options[hidden] {
  display: none;
}

.login-options button {
  width: 100%;
  text-align: left;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 20px 20px 10px;
  border-bottom: 1px solid rgba(36, 73, 107, 0.55);
}

.app-panel:not(.chat-open) .app-header {
  min-height: 58px;
  padding: 13px 18px;
}

.app-panel:not(.chat-open) .app-header-title {
  display: flex;
  align-items: center;
}

.app-panel:not(.chat-open) .app-header-title h2 {
  display: none;
}

.app-panel:not(.chat-open) .app-header-title .eyebrow {
  margin: 0;
}

.app-header-title {
  min-width: 0;
  flex: 1;
}

.app-panel.chat-open .app-header-title.is-conversation-link {
  display: grid;
  grid-template-rows: 22px 16px;
  align-content: center;
  cursor: pointer;
  border-radius: 8px;
  outline: 2px solid transparent;
  outline-offset: 2px;
}

.app-panel.chat-open .app-header-title.is-conversation-link h2 {
  grid-row: 1;
  align-self: end;
}

.app-panel.chat-open .app-header-title.is-conversation-link .chat-header-status {
  grid-row: 2;
  align-self: start;
}

.app-panel.chat-open .app-header-title.is-conversation-link:focus-visible {
  outline-color: #75baff;
}

.app-panel.chat-open .app-header-title:has(.chat-header-avatar:not([hidden])) {
  display: grid;
  grid-template-columns: var(--chat-header-leading-size, 44px) minmax(0, 1fr);
  grid-template-rows: 22px 16px;
  column-gap: 10px;
  align-items: center;
}

.app-panel.chat-open .app-header-title:has(.chat-header-avatar:not([hidden])) .chat-header-avatar,
.app-panel.chat-open .app-header-title:has(.chat-header-avatar:not([hidden])) h2 {
  align-self: center;
}

.app-panel.chat-open .app-header-title:has(.chat-header-avatar:not([hidden])) .chat-header-avatar {
  grid-row: 1 / 3;
}

.app-panel.chat-open .app-header-title:has(.chat-header-avatar:not([hidden])) h2 {
  grid-row: 1;
}

.app-panel.chat-open .app-header-title:has(.chat-header-avatar:not([hidden])) .eyebrow,
.app-panel.chat-open .app-header-title:has(.chat-header-avatar:not([hidden])) h2 {
  grid-column: 2;
}

.chat-header-status {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-panel.chat-open .app-header-title:has(.chat-header-avatar:not([hidden])) .chat-header-status {
  grid-row: 2;
  grid-column: 2;
}

.chat-header-avatar,
.profile-avatar {
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 999px;
  background: #12385d;
  color: var(--accent);
  font-weight: 800;
}

.chat-header-avatar {
  position: relative;
  grid-row: 1 / 3;
  width: var(--chat-header-leading-size, 44px);
  height: var(--chat-header-leading-size, 44px);
  overflow: visible;
}

.chat-header-avatar img {
  border-radius: inherit;
}

.chat-header-avatar.has-mode-notification::after {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border: 2px solid var(--panel);
  border-radius: 50%;
  content: "";
  background: #35c96f;
  box-shadow: 0 0 0 1px rgba(5, 20, 12, 0.32);
}

.chat-header-avatar.is-clickable {
  cursor: pointer;
  outline: 2px solid transparent;
  outline-offset: 2px;
}

.chat-header-avatar.is-clickable:hover,
.chat-header-avatar.is-clickable:focus-visible {
  outline-color: var(--accent);
}

.chat-header-avatar img,
.profile-avatar img,
.contact-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-photo-setting {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  width: 100%;
}

.profile-avatar {
  width: 78px;
  height: 78px;
  font-size: 28px;
}

.profile-photo-editor {
  position: relative;
  width: 78px;
  height: 78px;
}

.profile-photo-edit {
  position: relative;
  display: block;
  width: 78px;
  height: 78px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
}

.profile-photo-edit:hover,
.profile-photo-edit:focus-visible {
  background: transparent;
}

.profile-photo-edit-icon {
  position: absolute;
  right: -2px;
  bottom: -2px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 2px solid var(--panel, #07110b);
  border-radius: 50%;
  color: #06110a;
  background: var(--accent, #61ff83);
  font-size: 16px;
  line-height: 1;
}

.profile-photo-remove {
  position: absolute;
  z-index: 2;
  top: -7px;
  right: -7px;
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  min-height: 0;
  padding: 0;
  border: 2px solid var(--panel, #07110b);
  border-radius: 50%;
  color: #fff;
  background: #d83b3b;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
}

.profile-photo-remove:hover,
.profile-photo-remove:focus-visible {
  background: #ef4d4d;
}

.setting-choice-description,
.setting-direction-note {
  margin: 0;
  line-height: 1.45;
}

.setting-choice-description {
  color: var(--text);
  font-weight: 700;
}

.setting-direction-note {
  padding-left: 10px;
  border-left: 2px solid var(--accent);
}

.app-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-call-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  padding: 0;
  border-radius: 50%;
  background: #0b2112;
  color: var(--accent);
  font-size: 20px;
}

.call-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(12px);
}

.call-dialog {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(390px, 100%);
  min-height: 440px;
  padding: 48px 24px 34px;
  border: 1px solid #24496b;
  border-radius: 8px;
  background: linear-gradient(180deg, #0b1a10, #030805);
  text-align: center;
}

.call-avatar {
  display: grid;
  place-items: center;
  width: 104px;
  height: 104px;
  border: 2px solid #4d9ce8;
  border-radius: 50%;
  background: #12385d;
  color: var(--accent);
  font-size: 42px;
  font-weight: 800;
}

.call-dialog h2,
.call-dialog p {
  margin: 0;
}

.call-dialog p,
.call-dialog time {
  color: var(--muted);
}

.call-actions {
  align-self: end;
  display: flex;
  justify-content: center;
  gap: 42px;
  width: 100%;
  margin-top: auto;
}

.call-action {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  min-width: 64px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  font-size: 26px;
}

.call-action.accept {
  background: #22b85a;
  color: #fff;
}

.call-action.decline {
  background: #e85555;
  color: #fff;
}

.call-action svg {
  width: 29px;
  height: 29px;
  fill: currentColor;
}

.call-action.accept svg {
  transform: rotate(-12deg);
}

.call-action.decline svg {
  transform: rotate(135deg);
}

.call-action-choice {
  display: grid;
  justify-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
}

.call-action.neutral {
  background: #193522;
}

.call-action.neutral.muted {
  background: #e6f4e8;
  color: #07110b;
}

.video-call-stage {
  position: relative;
  width: 100%;
  min-height: 260px;
  overflow: hidden;
  border: 1px solid #24496b;
  border-radius: 8px;
  background: #000;
}

.video-call-stage > video:first-child {
  width: 100%;
  height: 100%;
  min-height: 260px;
  object-fit: cover;
}

.video-call-stage > video:last-child {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 92px;
  aspect-ratio: 3 / 4;
  border: 1px solid #4d9ce8;
  border-radius: 6px;
  background: #07110b;
  object-fit: cover;
  transform: scaleX(-1);
}

.video-call-stage > video:last-child.rear-camera {
  transform: none;
}

.call-backdrop.video-call .call-dialog {
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  width: min(560px, 100%);
  min-height: min(720px, 92dvh);
  padding-top: 24px;
  overflow: hidden;
}

.call-backdrop.video-call .call-dialog > audio {
  display: none;
}

.call-backdrop.video-call .video-call-stage {
  min-height: 0;
  height: 100%;
}

.call-backdrop.video-call .video-call-stage > video:first-child {
  display: block;
  min-height: 0;
}

.call-backdrop.video-call .call-actions {
  gap: 18px;
}

@media (max-width: 520px) {
  .call-backdrop {
    padding: 0;
  }

  .call-dialog {
    width: 100%;
    min-height: 100dvh;
    border: 0;
    border-radius: 0;
    padding-top: max(62px, calc(28px + env(safe-area-inset-top)));
    padding-bottom: max(34px, calc(20px + env(safe-area-inset-bottom)));
  }

  .call-backdrop.video-call .call-dialog {
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    gap: 7px;
    padding: max(46px, calc(12px + env(safe-area-inset-top))) 12px max(18px, calc(10px + env(safe-area-inset-bottom)));
  }

  .call-backdrop.video-call .call-dialog h2 {
    font-size: clamp(22px, 7vw, 30px);
    line-height: 1.1;
  }

  .call-backdrop.video-call .call-dialog p,
  .call-backdrop.video-call .call-dialog time {
    font-size: 14px;
  }

  .call-backdrop.video-call .video-call-stage {
    width: 100%;
    height: 100%;
    min-height: 0;
    border-radius: 6px;
  }

  .call-backdrop.video-call .video-call-stage > video:first-child {
    width: 100%;
    height: 100%;
    min-height: 0;
  }

  .call-backdrop.video-call .video-call-stage > video:last-child {
    right: 10px;
    bottom: 10px;
    width: clamp(78px, 25vw, 108px);
    max-height: 36%;
  }

  .call-backdrop.video-call .active-call-actions {
    display: grid;
    grid-template-columns: repeat(4, 56px);
    justify-content: center;
    gap: clamp(10px, 3.5vw, 18px);
    padding-top: 5px;
  }

  .call-backdrop.video-call .call-action {
    width: 56px;
    height: 56px;
    min-width: 56px;
    font-size: 23px;
  }
}

.app-header-title h2 {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-header-actions {
  display: flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  gap: 14px;
}

.chat-language-switcher {
  display: block;
  margin: 0;
}

.chat-language-switcher select {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  font-size: 16px;
}

.chat-back-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 0;
}

.chat-back-button svg {
  display: block;
  width: 26px;
  height: 26px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-header h2 {
  margin-bottom: 0;
}

.app-status {
  min-height: 24px;
  margin: 0;
  padding: 10px 20px 0;
}

.app-status:empty {
  display: none;
}

.app-view {
  width: 100%;
  max-width: 100%;
  min-height: 0;
  min-width: 0;
  overflow: auto;
  padding: 16px 20px 96px;
}

.empty-state {
  display: grid;
  gap: 6px;
  border: 1px dashed #24496b;
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 16px;
  color: var(--muted);
}

.empty-state strong {
  color: var(--text);
}

.chat-layout,
.vault-layout {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.chat-create-tools {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.chat-search-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  margin: 0 18px 10px;
}

.chat-search-panel[hidden] {
  display: none;
}

.chat-search-panel input {
  min-height: 46px;
  border-radius: 23px;
  padding-right: 18px;
  padding-left: 18px;
}

.chat-search-button .chat-search-close-icon,
.chat-search-button[aria-expanded="true"] .chat-search-open-icon {
  display: none;
}

.chat-search-button[aria-expanded="true"] .chat-search-close-icon {
  display: block;
}

.chat-search-empty {
  margin: 20px 18px;
  color: var(--muted);
  text-align: center;
}

.header-create-action {
  position: relative;
  display: grid;
  place-items: center;
}

.header-create-action[hidden] {
  display: none;
}

.header-connection-status {
  --connection-color: var(--accent);
  --connection-glow: rgba(120, 255, 145, 0.22);
  width: 14px;
  height: 14px;
  margin: 13px;
  border: 2px solid var(--connection-color);
  border-radius: 50%;
  background: var(--connection-color);
  box-shadow: 0 0 0 5px var(--connection-glow);
}

.header-connection-status[hidden] {
  display: none;
}

.header-connection-status[data-connection-state="checking"],
.header-connection-status[data-connection-state="degraded"] {
  --connection-color: #ffd35a;
  --connection-glow: rgba(255, 211, 90, 0.2);
}

.header-connection-status[data-connection-state="offline"] {
  --connection-color: #ff6b64;
  --connection-glow: rgba(255, 107, 100, 0.2);
}

.chat-create-menu-button {
  --connection-color: var(--accent);
  --connection-glow: rgba(120, 255, 145, 0.22);
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  border: 2px solid var(--connection-color);
  border-radius: 50%;
  color: var(--connection-color);
  background: #07110b;
  box-shadow: 0 0 0 5px var(--connection-glow);
  transition: border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.chat-create-menu-button svg {
  display: block;
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.8;
  stroke-linecap: round;
}

.chat-create-menu-button[data-connection-state="checking"],
.chat-create-menu-button[data-connection-state="degraded"] {
  --connection-color: #ffd35a;
  --connection-glow: rgba(255, 211, 90, 0.2);
}

.chat-create-menu-button[data-connection-state="offline"] {
  --connection-color: #ff6b64;
  --connection-glow: rgba(255, 107, 100, 0.2);
}

.chat-create-menu-button:hover,
.chat-create-menu-button:focus-visible {
  color: #020503;
  background: var(--connection-color);
}

.chat-create-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  gap: 6px;
  width: min(280px, calc(100vw - 40px));
  padding: 8px;
  border: 1px solid #3f8fc9;
  border-radius: 10px;
  background: #07110b;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.58);
}

.chat-create-menu[hidden] {
  display: none;
}

.chat-create-menu button {
  width: 100%;
  text-align: left;
}

.contact-invite-result {
  width: min(440px, 100%);
  justify-self: start;
}

.contact-invite-copy-field {
  position: relative;
  min-width: 0;
  cursor: pointer;
  border: 1px solid #255273;
  border-radius: 8px;
  background: #020503;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.contact-invite-copy-field:hover,
.contact-invite-copy-field:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(40, 151, 215, 0.16);
  outline: none;
}

.invite-result .contact-invite-copy-field code {
  min-height: 64px;
  border: 0;
  padding: 12px 52px 18px 12px;
  background: transparent;
}

.contact-invite-copy-button {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: grid;
  width: 38px;
  height: 38px;
  min-height: 0;
  padding: 8px;
  place-items: center;
  border-radius: 10px;
}

.contact-invite-copy-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.contact-invite-copy-check {
  display: none;
}

.contact-invite-copy-button.is-copied {
  border-color: #2fc96b;
  color: #146f39;
  background: #dff8e8;
}

.contact-invite-copy-button.is-copied .contact-invite-copy-icon {
  display: none;
}

.contact-invite-copy-button.is-copied .contact-invite-copy-check {
  display: block;
}

.contact-invite-result #contact-invite-qr {
  width: min(280px, 76vw);
  justify-self: center;
  margin: 8px 0;
}

.contact-invite-close {
  width: 100%;
}

.chat-mode-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
  max-width: 100%;
  gap: 4px;
  padding: 4px;
  border: 1px solid #24496b;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.24);
}

.chat-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 50px;
  padding: 7px 12px;
  border-bottom: 1px solid rgba(36, 73, 107, 0.6);
  background: rgba(3, 8, 5, 0.97);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.chat-toolbar .chat-mode-control {
  width: 100%;
  flex: 1 1 100%;
  padding: 2px;
}

.chat-toolbar .chat-mode-control button {
  width: 100%;
  max-width: 100%;
  min-height: 32px;
  padding: 4px 10px;
  font-size: 13px;
  text-align: center;
}

.chat-toolbar .group-actions {
  display: flex;
  gap: 6px;
}

.chat-toolbar .group-actions button {
  min-height: 34px;
  width: auto;
  padding: 5px 9px;
  font-size: 12px;
}

.privacy-retention-control {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.privacy-retention-hint {
  flex: 0 0 100%;
  line-height: 1.35;
  color: var(--muted);
}

.privacy-retention-control select {
  width: auto;
  min-width: 92px;
  min-height: 34px;
  padding: 4px 28px 4px 8px;
  font-size: 12px;
}

.chat-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
}

.message-footer {
  display: grid;
  gap: 6px;
  padding: 7px 10px calc(7px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(36, 73, 107, 0.72);
  background: rgba(3, 8, 5, 0.98);
  min-width: 0;
  max-width: 100%;
  overflow: visible;
}

body.message-actions-open .message-footer {
  visibility: hidden;
  pointer-events: none;
}

.message-footer .chat-status-row {
  justify-content: flex-start;
  min-height: 22px;
  flex-wrap: nowrap;
  width: 100%;
  overflow: hidden;
}

.message-footer .translate-chip {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  max-width: none;
  padding: 3px 8px;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-footer .chat-translation-toggle {
  order: -1;
  flex: 0 0 auto;
  min-width: 86px;
  min-height: 24px;
  padding: 2px 4px;
  font-size: 12px;
}

.message-footer .chat-translation-toggle input {
  width: 16px;
  height: 16px;
}

.message-input-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 44px;
  align-items: center;
  gap: 8px;
}

.reply-composer-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px 8px 7px 11px;
  border-left: 3px solid #75baff;
  border-radius: 5px;
  background: rgba(117, 186, 255, 0.09);
}

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

.reply-composer-preview > div.has-thumbnail {
  grid-template-columns: minmax(0, 1fr) 40px;
}

.reply-composer-preview > div.has-thumbnail strong,
.reply-composer-preview > div.has-thumbnail span {
  grid-column: 1;
}

.reply-composer-preview strong {
  color: #75baff;
  font-size: 11px;
}

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

.reply-composer-preview .reply-thumbnail {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
}

.reply-cancel-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
}

.chat-theme-privacy .reply-composer-preview {
  border-left-color: #c4a2ff;
  background: rgba(196, 162, 255, 0.09);
}

.chat-theme-privacy .reply-composer-preview strong {
  color: #c4a2ff;
}

.composer-tools {
  position: relative;
  display: grid;
  place-items: center;
}

.composer-menu-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  transition: transform 160ms ease, background 160ms ease;
}

.composer-menu-button svg {
  display: block;
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.composer-menu-button[aria-expanded="true"] {
  transform: rotate(45deg);
  background: transparent;
}

.composer-menu-button:disabled {
  opacity: 0.35;
}

.composer-menu {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 0;
  z-index: 12;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: min(420px, calc(100vw - 24px));
  max-height: min(58dvh, 470px);
  padding: 18px 12px 16px;
  gap: 16px 8px;
  border: 1px solid #24496b;
  border-radius: 26px;
  background: #07110b;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
  overflow-x: hidden;
  overflow-y: auto;
}

.composer-menu[hidden] {
  display: none;
}

.composer-menu button {
  display: grid;
  grid-template-rows: 56px auto;
  place-items: center;
  align-content: start;
  gap: 7px;
  width: 100%;
  min-width: 0;
  min-height: 82px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
}

.composer-menu button:hover,
.composer-menu button:focus-visible {
  background: #174626;
}

.composer-menu button:disabled {
  display: none;
}

.composer-menu button[hidden] {
  display: none;
}

.composer-menu-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 1px solid #4d9ce8;
  border-radius: 50%;
  background: #0b2112;
  font-size: 24px;
}

.composer-menu-label {
  display: -webkit-box;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.composer-menu .view-once-menu-icon {
  width: 56px;
  height: 56px;
  font-size: 18px;
}

[dir="rtl"] .composer-menu {
  right: 0;
  left: auto;
}

.voice-recording-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  color: var(--text);
}

.voice-recording-row[hidden] {
  display: none;
}

.voice-recording-row > span:not(.voice-recording-dot) {
  color: var(--muted);
  font-size: 12px;
}

.voice-recording-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.voice-recording-row button {
  min-height: 32px;
  padding: 5px 10px;
  font-size: 12px;
  white-space: nowrap;
}

@media (max-width: 430px) {
  .voice-recording-row > span:not(.voice-recording-dot) {
    display: none;
  }

  .voice-recording-row button {
    padding-right: 8px;
    padding-left: 8px;
  }
}

.voice-recording-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ff6f61;
  animation: voice-pulse 1s ease-in-out infinite;
}

@keyframes voice-pulse {
  50% { opacity: 0.35; }
}

.message-input-row textarea {
  width: 100%;
  min-height: 44px;
  max-height: 112px;
  resize: none;
  border-radius: 22px;
  padding: 10px 15px;
  font-size: var(--chat-text-size);
  line-height: 1.35;
  overflow-y: auto;
}

.message-text-wrap {
  position: relative;
  min-width: 0;
}

.privacy-composer-shield {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 15px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: #d8bdff;
  font-size: 19px;
  line-height: 1;
  pointer-events: none;
  transform: translateY(-50%);
}

.app-panel.chat-open.chat-theme-privacy .message-text-wrap textarea {
  padding-left: 44px;
}

[dir="rtl"] .privacy-composer-shield {
  right: 15px;
  left: auto;
}

[dir="rtl"] .app-panel.chat-open.chat-theme-privacy .message-text-wrap textarea {
  padding-right: 44px;
  padding-left: 15px;
}

.send-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 999px;
  color: #031007;
  background: var(--accent);
}

.send-button svg {
  display: block;
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.send-button:disabled {
  cursor: wait;
  opacity: 0.48;
}

.composer-icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 999px;
  background: #0b2112;
  font-size: 21px;
  line-height: 1;
}

.composer-icon-button:disabled {
  cursor: wait;
  opacity: 0.48;
}

.location-share-dialog {
  grid-template-rows: auto auto;
  width: min(440px, 100%);
}

.contact-share-dialog {
  grid-template-rows: auto auto auto minmax(0, 1fr);
  width: min(440px, 100%);
  max-height: min(680px, 82dvh);
}

.contact-picker-search {
  min-height: 44px;
}

.contact-share-dialog .contact-picker-search {
  width: auto;
  margin: 4px 18px 8px;
}

.group-create-panel .contact-picker-search {
  width: 100%;
  margin: 2px 0 8px;
}

.contact-share-hint {
  margin: 0;
  padding: 14px 18px 8px;
  color: var(--muted);
}

.contact-share-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 120px;
  padding: 8px 18px 18px;
  overflow-y: auto;
}

.contact-share-option {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
}

.shared-contact-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: min(330px, 72vw);
}

.shared-contact-type {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.11em;
  line-height: 1.2;
  text-transform: uppercase;
}

.shared-contact-type-icon {
  position: relative;
  display: inline-block;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}

.shared-contact-type-icon::before {
  position: absolute;
  top: 3px;
  left: 5px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.shared-contact-type-icon::after {
  position: absolute;
  bottom: 2px;
  left: 3px;
  width: 8px;
  height: 4px;
  border-radius: 8px 8px 3px 3px;
  background: currentColor;
  content: "";
}

.shared-contact-card .contact-avatar {
  width: 44px;
  height: 44px;
}

.shared-contact-card-info {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.shared-contact-card-info strong,
.shared-contact-card-info small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shared-contact-card button {
  width: auto;
  padding: 8px 10px;
}

.location-share-content {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 20px;
  text-align: center;
}

.location-share-content p {
  margin: 0;
}

.location-share-pin {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 1px solid #3f8fc9;
  border-radius: 50%;
  background: #0c2916;
  font-size: 30px;
}

.location-share-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  margin-top: 6px;
}

.poll-dialog {
  width: min(460px, 100%);
  max-height: min(760px, 90dvh);
  overflow-y: auto;
}

.event-dialog {
  width: min(500px, 100%);
  max-width: 100%;
  max-height: min(820px, 92dvh);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-x: none;
  touch-action: pan-y;
}

.event-dialog > input,
.event-dialog > textarea,
.event-dialog > select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.event-dialog textarea {
  min-height: 88px;
  resize: vertical;
}

.event-location-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 8px;
  width: 100%;
}

.event-location-input input {
  min-width: 0;
}

.event-location-button {
  display: grid;
  place-items: center;
  width: 48px;
  min-width: 48px;
  height: 48px;
  padding: 0;
  font-size: 20px;
}

.event-location-button[aria-busy="true"] {
  opacity: 0.65;
}

.event-date-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.event-date-grid label {
  display: grid;
  gap: 6px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.event-date-grid input {
  display: block;
  width: 100%;
  inline-size: 100%;
  height: 52px;
  block-size: 52px;
  min-height: 52px;
  min-block-size: 52px;
  min-width: 0;
  min-inline-size: 0;
  max-width: 100%;
  max-inline-size: 100%;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

.event-reminder-note {
  margin: -3px 0 2px;
  font-size: 12px;
}

.poll-option-editor-list {
  display: grid;
  gap: 8px;
}

.poll-option-editor-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 66px 42px;
  gap: 8px;
}

.poll-option-editor-row input {
  min-width: 0;
}

.poll-option-remove {
  width: 42px;
  min-width: 42px;
  padding: 0;
  font-size: 24px;
}

.poll-option-order {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
}

.poll-option-move {
  min-width: 0;
  padding: 0;
  font-size: 17px;
}

.poll-option-move:disabled {
  opacity: 0.28;
}

.poll-add-option {
  justify-self: start;
}

.poll-multiple-toggle {
  padding: 8px 0;
}

.poll-status {
  min-height: 20px;
  margin: 0;
}

.chat-translation-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.chat-translation-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.chat-translation-toggle.disabled {
  opacity: 0.55;
}

.group-tools,
.group-create-panel {
  display: grid;
  gap: 10px;
}

.group-actions,
.group-create-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.group-create-panel {
  border: 1px solid #24496b;
  border-radius: 8px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.2);
}

.group-panel-backdrop {
  position: fixed;
  z-index: 900;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  padding-top: calc(16px + env(safe-area-inset-top));
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.76);
  backdrop-filter: blur(3px);
}

.group-panel-dialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(560px, 100%);
  max-height: min(78dvh, 720px);
  overflow: hidden;
  border: 1px solid #3f8fc9;
  border-radius: 8px;
  background: #07110b;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.68);
}

.group-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid #24496b;
}

.group-panel-header h3 {
  margin: 0;
  font-size: 18px;
}

.icon-close-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  min-width: 38px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--text);
  font-size: 28px;
  line-height: 1;
}

.group-member-list,
.group-contact-picker {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
}

.group-panel-dialog .group-member-list,
.group-panel-dialog .invite-result {
  max-height: none;
  min-height: 0;
  overflow: auto;
  padding: 12px;
}

.group-panel-dialog .invite-result {
  display: grid;
  gap: 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.group-contact-invite-section,
.group-qr-invite-section,
#group-invite-qr-result {
  display: grid;
  gap: 10px;
}

.group-contact-invite-section p {
  margin: 0;
}

.group-invite-contact-picker {
  display: grid;
  gap: 6px;
}

.group-invite-contact-row,
.group-proposal-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px 2px;
}

.group-invite-contact-row > strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-proposal-heading {
  margin: 2px 0 4px;
  color: var(--accent);
  font-size: 13px;
}

.group-proposal-row {
  border: 1px solid var(--separator);
  border-radius: 8px;
  padding: 8px;
}

.group-proposal-row > span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.group-proposal-row small {
  color: var(--muted);
}

.group-panel-dialog .invite-result img {
  width: min(230px, 100%);
  height: auto;
  justify-self: center;
  border-radius: 6px;
  background: #fff;
}

.group-member-row,
.group-contact-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  border-bottom: 1px solid #173a59;
  padding: 8px 2px;
}

.group-member-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border-bottom: 0;
  padding: 7px 2px;
}

.group-member-row:last-child,
.group-contact-option:last-child {
  border-bottom: 0;
}

.group-member-row > span,
.group-contact-option > span {
  min-width: 0;
  flex: 1;
  overflow-wrap: anywhere;
}

.group-member-row button,
.contact-request-row button {
  width: auto;
  min-height: 36px;
  padding: 6px 9px;
}

.group-member-actions,
.contact-request-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.contact-request-row .remove-contact-request {
  display: grid;
  place-items: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #c93636;
  color: #fff;
  font-size: 25px;
  font-weight: 700;
  line-height: 1;
}

.contact-request-row .remove-contact-request:hover,
.contact-request-row .remove-contact-request:focus-visible {
  background: #ef4b4b;
}

.group-member-actions {
  flex-wrap: nowrap;
  gap: 5px;
}

.group-member-row .group-member-action {
  min-height: 30px;
  padding: 4px 7px;
  font-size: 11px;
  line-height: 1.15;
  white-space: nowrap;
}

.contact-request-heading {
  margin: 4px 0 2px;
  color: var(--accent);
  font-size: 14px;
}

.contact-request-row {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid #2d6f3f;
  border-radius: 8px;
  background: #0a1710;
}

.contact-request-row > div:not(.contact-request-actions) {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.contact-request-row span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.group-contact-option input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

/* Keep the group contact picker compact while preserving a full-row touch target. */
.group-create-panel .group-contact-picker {
  gap: 0;
}

.group-create-panel .group-contact-option {
  min-height: 44px;
  margin: 0;
  padding: 5px 2px;
  border: 0;
}

.group-create-panel .group-contact-option input {
  flex: 0 0 auto;
  margin: 0;
}

.message-sender {
  display: block;
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 12px;
}

.chat-mode-control button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 42px;
  padding: 8px 6px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.chat-mode-control button.has-unread::after {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  content: attr(data-unread);
  background: #35c96f;
  color: #04170b;
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
}

.chat-mode-control button.active {
  border-color: #3f8fc9;
  background: #12385d;
  color: var(--accent);
}

.translate-chip {
  width: fit-content;
  max-width: 100%;
  border: 1px solid rgba(120, 255, 145, 0.28);
  border-radius: 999px;
  background: rgba(255, 176, 64, 0.08);
  color: #ffd58a;
  padding: 7px 11px;
  font-size: 13px;
  line-height: 1.25;
}

.translate-chip.active {
  background: rgba(120, 255, 145, 0.12);
  color: var(--accent);
}

.translate-chip.privacy {
  border-color: rgba(120, 255, 145, 0.42);
  background: rgba(18, 56, 93, 0.72);
  color: var(--accent);
}

.contact-list {
  display: grid;
  gap: 10px;
}

.archived-conversations-entry {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 10px 12px;
  border-color: #24496b;
  background: rgba(12, 38, 21, 0.72);
  color: var(--text);
  text-align: left;
}

.archived-conversations-entry strong {
  font-size: 16px;
}

.archived-conversations-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid #3a7f4d;
  border-radius: 7px;
  color: var(--accent);
}

.archived-conversations-entry-count,
.archived-conversations-header-count {
  display: grid;
  place-items: center;
  min-width: 25px;
  height: 25px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--accent);
  color: #020503;
  font-size: 12px;
  font-weight: 800;
}

.archived-conversations-header {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 9px 18px;
  border-bottom: 1px solid #24496b;
}

.archived-conversations-header strong {
  font-size: 19px;
  text-align: left;
}

.archived-conversations-back {
  width: 42px;
  min-height: 42px;
  padding: 0;
  font-size: 22px;
}

.archived-conversations-empty {
  margin: 0;
  padding: 10px 6px;
  color: var(--muted);
  text-align: center;
}

.contact-list.archived-conversations-active {
  animation: archived-conversations-enter 160ms ease-out;
}

@keyframes archived-conversations-enter {
  from {
    opacity: 0;
    transform: translateX(18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.contact-tools {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.blocked-contacts-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  text-align: center;
}

.blocked-contacts-count {
  position: absolute;
  right: 12px;
  min-width: 26px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}

.blocked-contacts-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #24496b;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
}

.blocked-contacts-panel > p {
  margin: 0;
  color: var(--muted);
}

.invite-result {
  display: grid;
  gap: 10px;
  border: 1px solid #173a59;
  border-radius: 8px;
  padding: 14px;
  background: rgba(0, 0, 0, 0.18);
}

.invite-result span {
  color: var(--muted);
}

.invite-result code {
  display: block;
  overflow-wrap: anywhere;
  border: 1px solid #255273;
  border-radius: 6px;
  padding: 10px;
  color: var(--accent);
  background: #020503;
}

.invite-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.invite-actions > * {
  flex: 1 1 150px;
}

.split-actions {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.contact-app-choice {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  border: 1px solid #255273;
  border-radius: 14px;
  padding: 16px;
  background: rgba(31, 143, 216, 0.08);
}

.contact-app-choice h3,
.contact-app-choice p {
  margin: 0;
}

.contact-store-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.contact-store-button,
.contact-open-app {
  min-height: 48px;
  align-items: center;
  border-color: #2e91cf;
  background: #123552;
  color: #f4f9fd;
  text-align: center;
}

.contact-open-app {
  background: #1f8fd8;
  color: #fff;
}

.contact-install-note,
.contact-browser-note {
  font-size: 0.9rem;
  line-height: 1.45;
}

#contact-account-options {
  margin-top: 16px;
}

@media (max-width: 520px) {
  .contact-store-actions {
    grid-template-columns: 1fr;
  }
}

.scanner {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.scanner video {
  width: 100%;
  max-height: 320px;
  border: 1px solid #24496b;
  border-radius: 8px;
  background: #020503;
  object-fit: cover;
}

.divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  margin: 18px 0;
}

.divider::before,
.divider::after {
  content: "";
  height: 1px;
  background: #173a59;
}

.invite-result img {
  width: min(220px, 100%);
  aspect-ratio: 1;
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.contact-row {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid #173a59;
  border-radius: 8px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.18);
  cursor: pointer;
  -webkit-touch-callout: none;
  user-select: none;
}

.contact-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  overflow: hidden;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: #12385d;
  color: var(--accent);
  font-weight: 800;
}

.contact-row div {
  display: grid;
  flex: 1 1 auto;
  min-width: 0;
  gap: 2px;
}

.contact-row div > span {
  color: var(--muted);
  font-size: 14px;
}

.contact-name-line {
  display: flex !important;
  align-items: center;
  min-width: 0;
  gap: 7px !important;
}

.contact-name-line strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-row .contact-name-line strong {
  font-size: 18px;
  line-height: 1.2;
}

.contact-row .conversation-preview {
  display: block;
  overflow: hidden;
  max-width: 100%;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-list-loading {
  width: 100%;
}

.conversation-loading-row {
  display: flex;
  align-items: center;
  min-height: 70px;
  gap: 12px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--separator);
}

.conversation-loading-avatar,
.conversation-loading-copy i {
  display: block;
  background: color-mix(in srgb, var(--muted) 16%, transparent);
  animation: conversation-loading-pulse 1.15s ease-in-out infinite;
}

.conversation-loading-avatar {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
}

.conversation-loading-copy {
  display: grid;
  flex: 1;
  gap: 8px;
}

.conversation-loading-copy i {
  width: min(190px, 56%);
  height: 14px;
  border-radius: 999px;
}

.conversation-loading-copy i:last-child {
  width: min(260px, 78%);
  height: 10px;
  animation-delay: 90ms;
}

@keyframes conversation-loading-pulse {
  0%, 100% { opacity: 0.42; }
  50% { opacity: 0.9; }
}

.new-contact-label {
  flex: 0 0 auto;
  padding: 2px 5px;
  border: 1px solid rgba(120, 255, 145, 0.45);
  border-radius: 4px;
  color: var(--accent) !important;
  background: rgba(120, 255, 145, 0.08);
  font-size: 9px !important;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

.group-avatar {
  border-radius: 8px;
  border-color: #4d91b7;
  background: #123447;
  color: #a9e4ff;
}

.group-row {
  border-color: #315f78;
  background: rgba(35, 91, 120, 0.1);
}

.group-row:hover,
.group-row:focus-visible {
  border-color: #4d91b7;
  background: rgba(40, 111, 148, 0.16);
}

.mute-indicator {
  flex: 0 0 auto;
  margin-left: 6px;
  padding: 2px 6px;
  border: 1px solid #3f6550;
  border-radius: 4px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.22);
  font-size: 9px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

.danger-secondary {
  border-color: #69403a;
  color: #ff9a8e;
  background: #21110f;
}

.unread-badge {
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  margin-left: auto;
  border-radius: 999px;
  background: var(--accent);
  color: #020503;
  font-size: 12px;
  font-weight: 800;
}

.birthday-badge {
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  margin-left: auto;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, white);
  border: 1px solid var(--accent);
  font-size: 18px;
  line-height: 1;
}

.conversation-menu-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  margin-left: 2px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

.action-sheet-backdrop {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  align-items: end;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.72);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.action-sheet {
  display: grid;
  width: min(460px, 100%);
  margin: 0 auto;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #07110b;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
}

.action-sheet-backdrop.awaiting-pointer-release .action-sheet {
  pointer-events: none;
}

.action-sheet-backdrop.ios-keyboard-guard-active,
.group-panel-backdrop.ios-keyboard-guard-active {
  inset: var(--ios-keyboard-viewport-top, 0) 0 auto;
  height: var(--ios-keyboard-viewport-height, 100dvh);
  align-items: center;
  overflow-y: auto;
  padding-block: 8px;
}

.action-sheet-backdrop.ios-keyboard-guard-active > .action-sheet,
.group-panel-backdrop.ios-keyboard-guard-active > .group-panel-dialog {
  max-height: calc(var(--ios-keyboard-viewport-height, 100dvh) - 16px);
  overflow-y: auto;
  scroll-padding-block: 14px;
  overscroll-behavior: contain;
}

.app-view.ios-keyboard-guard-active,
.panel.ios-keyboard-guard-active {
  padding-bottom: max(calc(var(--ios-keyboard-inset, 0px) + 32px), 46vh);
  scroll-padding-bottom: max(calc(var(--ios-keyboard-inset, 0px) + 32px), 46vh);
}

.panel.ios-keyboard-guard-active {
  max-height: var(--ios-keyboard-viewport-height, 100dvh);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

body.app-active.ios-keyboard-open #user-bottom-nav {
  display: none;
}

body.app-active.ios-keyboard-open .app-panel:not(.chat-open) {
  grid-template-rows: minmax(0, 1fr);
}

body.app-active.business-settings-keyboard-open #user-bottom-nav {
  display: none;
}

body.app-active.business-settings-keyboard-open #view-settings {
  padding-bottom: max(calc(var(--ios-keyboard-inset, 0px) + 32px), 46vh);
  scroll-padding-bottom: max(calc(var(--ios-keyboard-inset, 0px) + 32px), 46vh);
}

.ios-keyboard-guard-active input,
.ios-keyboard-guard-active textarea,
.ios-keyboard-guard-active [contenteditable="true"] {
  scroll-margin-block: 14px;
}

#conversation-action-sheet.contact-renaming {
  inset: var(--contact-rename-viewport-top, 0) 0 auto;
  height: var(--contact-rename-viewport-height, 100dvh);
  align-items: center;
  overflow-y: auto;
  padding-block: 8px;
}

#conversation-action-sheet.contact-renaming .action-sheet {
  max-height: calc(var(--contact-rename-viewport-height, 100dvh) - 16px);
  overflow-y: auto;
  scroll-padding-bottom: 12px;
  overscroll-behavior: contain;
}

#message-action-sheet.message-editing {
  inset: var(--message-edit-viewport-top, 0) 0 auto;
  height: var(--message-edit-viewport-height, 100dvh);
  align-items: center;
  overflow-y: auto;
  padding-block: 8px;
}

#message-action-sheet.message-editing .action-sheet {
  max-height: calc(var(--message-edit-viewport-height, 100dvh) - 16px);
  overflow-y: auto;
  scroll-padding-bottom: 12px;
  overscroll-behavior: contain;
}

#message-action-sheet.message-editing .message-action-preview {
  display: none;
}

#message-action-sheet.message-editing #edit-message-input {
  max-height: min(26dvh, 220px);
  resize: none;
}

.action-sheet h3 {
  margin: 0 0 6px;
  overflow-wrap: anywhere;
  text-align: center;
}

.message-action-preview {
  display: -webkit-box;
  overflow: hidden;
  margin-bottom: 2px;
  padding: 10px 12px;
  border-left: 3px solid #75baff;
  border-radius: 4px;
  background: #0b1d2c;
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.action-sheet-edit {
  display: grid;
  min-width: 0;
  gap: 10px;
}

#birthday-contact-form,
#birthday-contact-input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

#birthday-contact-input {
  display: block;
  box-sizing: border-box;
}

.birthday-ios-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.birthday-ios-picker[hidden],
#birthday-contact-input[hidden] {
  display: none !important;
}

.birthday-ios-picker select {
  width: 100%;
  min-width: 0;
  height: 58px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  text-align: center;
}

#birthday-contact-form.ios-birthday-editor {
  overflow: hidden;
  contain: inline-size;
}

#birthday-contact-form.ios-birthday-editor #birthday-contact-input {
  inline-size: 100% !important;
  block-size: 54px !important;
  min-block-size: 54px !important;
  min-inline-size: 0 !important;
  max-inline-size: 100% !important;
  padding-block: 10px !important;
  padding-inline: 14px !important;
  -webkit-appearance: none;
  appearance: none;
}

.action-sheet-label {
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.mute-duration-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.privacy-unlock-backdrop {
  align-items: center;
}

.privacy-unlock-dialog p {
  margin: 0;
  text-align: center;
}

.privacy-unlock-status {
  min-height: 20px;
  color: #ff8b7d !important;
}

.emergency-business-fieldset {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.emergency-business-fieldset legend {
  padding: 0 6px;
  color: var(--muted);
  font-weight: 700;
}

#emergency-business-list {
  display: grid;
  gap: 8px;
}

#emergency-business-list label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.chat-placeholder {
  display: grid;
  gap: 6px;
  min-height: 240px;
  align-content: center;
  justify-items: center;
  text-align: center;
  border: 1px dashed #24496b;
  border-radius: 8px;
  padding: 24px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.18);
}

.chat-placeholder strong {
  color: var(--text);
}

.message-list {
  display: grid;
  grid-auto-flow: row;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 10px;
  min-height: 240px;
  max-height: 52vh;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid #173a59;
  border-radius: 8px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.18);
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.message-list-shell {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.message-list-shell .message-list {
  width: 100%;
  height: 100%;
}

.jump-to-latest {
  position: absolute;
  z-index: 4;
  right: 14px;
  bottom: 14px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  min-width: 38px;
  padding: 0;
  border: 1px solid rgba(117, 186, 255, 0.58);
  border-radius: 50%;
  background: rgba(6, 17, 29, 0.88);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.28);
  color: #a9d5ff;
  font-size: 22px;
  line-height: 1;
  backdrop-filter: blur(6px);
}

.jump-to-latest strong:empty {
  display: none;
}

.jump-to-latest.has-new-messages {
  grid-auto-flow: column;
  width: auto;
  max-width: calc(100% - 28px);
  padding: 0 12px;
  border-radius: 999px;
  gap: 7px;
  font-size: 16px;
}

.jump-to-latest.has-new-messages strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jump-to-latest[hidden] {
  display: none;
}

.jump-to-latest:hover,
.jump-to-latest:focus-visible {
  border-color: #75baff;
  background: rgba(18, 56, 93, 0.95);
}

[dir="rtl"] .jump-to-latest {
  right: auto;
  left: 14px;
}

.message-system {
  justify-self: center;
  max-width: min(90%, 520px);
  margin: 8px auto;
  padding: 6px 10px;
  border: 1px solid #34563d;
  border-radius: 6px;
  background: #101b13;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.unread-divider {
  justify-self: stretch;
  padding: 5px 10px;
  border-top: 1px solid #3f8fc9;
  border-bottom: 1px solid #3f8fc9;
  color: var(--accent);
  background: rgba(18, 56, 93, 0.78);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.message-date-divider {
  justify-self: center;
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 5px 10px;
  border: 1px solid #24496b;
  border-radius: 8px;
  background: rgba(7, 17, 11, 0.94);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.message {
  --message-reply-swipe: 0px;
  --message-time-swipe: 0px;
  position: relative;
  justify-self: start;
  max-width: min(72ch, 100%);
  border: 1px solid #24496b;
  border-radius: 8px;
  background: var(--panel-2);
  padding: 10px 12px;
  touch-action: pan-y;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  transform: translateX(calc(var(--message-reply-swipe) + var(--message-time-swipe)));
  transition: transform 160ms ease-out;
}

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

#message-list .message.peer-typing-message {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 7px 4px;
  pointer-events: none;
}

.peer-typing-label {
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
  font-style: italic;
}

.peer-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 16px;
}

.peer-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: peer-typing-bounce 1.05s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

.peer-typing-dot:nth-child(2) {
  animation-delay: 140ms;
}

.peer-typing-dot:nth-child(3) {
  animation-delay: 280ms;
}

@keyframes peer-typing-bounce {
  0%, 60%, 100% {
    opacity: 0.38;
    transform: translateY(0) scale(0.9);
  }
  30% {
    opacity: 1;
    transform: translateY(-6px) scale(1.12);
  }
}

@media (prefers-reduced-motion: reduce) {
  .peer-typing-dot {
    animation-name: peer-typing-pulse;
    animation-duration: 1.4s;
    transform: none;
  }
}

@keyframes peer-typing-pulse {
  0%, 70%, 100% { opacity: 0.35; }
  35% { opacity: 1; }
}

.message-list > .message-line,
.message-list > .message-system,
.message-list > .message-date-divider,
.message-list > .unread-divider {
  align-self: start;
  min-height: max-content;
}

.message.has-media,
.message.has-location {
  height: max-content;
}

.chat-media-container,
.chat-media {
  flex-shrink: 0;
  touch-action: pan-y;
}

.message.message-swiping-reply {
  z-index: 2;
  transition: none;
  user-select: none;
}

.message.outgoing {
  --message-time-swipe: var(--message-list-time-swipe, 0px);
}

.message-time {
  position: absolute;
  right: 1px;
  bottom: 7px;
  width: 43px;
  z-index: 3;
  padding: 3px 4px;
  border-radius: 4px;
  background: rgba(3, 12, 8, 0.82);
  color: #e1ebe3;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1;
  text-align: right;
  opacity: var(--message-list-time-opacity, 0);
  pointer-events: none;
  transition: opacity 100ms linear;
}

.message-list.message-times-revealing .message.outgoing {
  transition: none;
}

.message-swipe-reply {
  position: absolute;
  top: 50%;
  left: -42px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: #75baff;
  font-size: 18px;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transform: translate(8px, -50%) scale(0.78);
  transition: opacity 120ms ease, transform 120ms ease;
}

.message.message-swiping-reply .message-swipe-reply {
  opacity: 0.62;
  transform: translate(0, -50%) scale(0.9);
}

.message.message-reply-ready .message-swipe-reply {
  opacity: 1;
  transform: translate(0, -50%) scale(1);
}

.app-panel.chat-open.chat-theme-privacy .message-swipe-reply {
  color: #c9a4f2;
}

.message:not(.emoji-only) {
  padding-right: 12px;
  font-size: var(--chat-text-size);
}

.message.has-receipt:not(.emoji-only) {
  padding-right: 34px;
  padding-bottom: 18px;
}

.message.message-action-active {
  box-shadow: 0 0 0 3px rgba(117, 186, 255, 0.58);
}

/* A pressed image can remain in a separate iOS compositing layer. The action
   sheet already identifies the selected message, so hide only its source row
   while the modal is open and restore it automatically when the modal closes. */
body.message-actions-open .message.message-action-active {
  visibility: hidden;
}

.app-panel.chat-open.chat-theme-privacy .message.message-action-active {
  box-shadow: 0 0 0 3px rgba(196, 162, 255, 0.62);
}

.message.outgoing {
  justify-self: end;
  background: #12385d;
  border-color: #4d9ce8;
}

.app-panel.chat-open.chat-theme-normal .app-header,
.app-panel.chat-open.chat-theme-normal .chat-toolbar,
.app-panel.chat-open.chat-theme-normal .message-footer {
  border-color: rgba(62, 139, 214, 0.72);
  background: #06111d;
}

.app-panel.chat-open.chat-theme-normal .message-list {
  position: relative;
  z-index: 1;
  background: transparent;
}

.app-panel.chat-open.chat-theme-normal .message-list-shell {
  isolation: isolate;
  background: #071a2b;
}

.app-panel.chat-open.chat-theme-normal .message-list-shell::before {
  position: absolute;
  z-index: 0;
  inset: 10%;
  content: "";
  pointer-events: none;
  background: url("/static/ajsim-letter-a.svg") center / contain no-repeat;
  opacity: 0.1;
}

.app-panel.chat-open.chat-theme-normal .chat-mode-control {
  border-color: #275f95;
  background: #030b14;
}

.app-panel.chat-open.chat-theme-normal .chat-mode-control button.active {
  border-color: #4d9ce8;
  background: #12385d;
  color: #a9d5ff;
}

.app-panel.chat-open.chat-theme-normal .message.outgoing {
  border-color: #4d9ce8;
  background: #12385d;
}

.app-panel.chat-open.chat-theme-normal .message:not(.outgoing):not(.emoji-only) {
  border-color: #275f95;
  background: #091b2b;
}

.app-panel.chat-open.chat-theme-normal .message-input-row textarea {
  border-color: #75baff;
  background: #eef6ff;
  color: #071727;
  caret-color: #12385d;
}

.app-panel.chat-open.chat-theme-normal .message-input-row textarea::placeholder {
  color: #5d7184;
  opacity: 1;
}

.app-panel.chat-open.chat-theme-normal .message-input-row textarea:focus {
  border-color: #4d9ce8;
  outline: 2px solid rgba(117, 186, 255, 0.3);
  outline-offset: 1px;
}

.app-panel.chat-open.chat-theme-normal .send-button {
  background: #75baff;
  color: #03101d;
}

.app-panel.chat-open.chat-theme-privacy .app-header,
.app-panel.chat-open.chat-theme-privacy .chat-toolbar,
.app-panel.chat-open.chat-theme-privacy .message-footer {
  border-color: rgba(116, 73, 159, 0.82);
  background: #100919;
}

.app-panel.chat-open.chat-theme-privacy .message-list {
  position: relative;
  z-index: 1;
  background: transparent;
}

.app-panel.chat-open.chat-theme-privacy .message-list-shell {
  isolation: isolate;
  background: #130d1a;
}

.app-panel.chat-open.chat-theme-privacy .message-list-shell::before {
  position: absolute;
  z-index: 0;
  inset: 10%;
  content: "";
  pointer-events: none;
  background: #2d1d3b;
  opacity: 0.46;
  -webkit-mask: url("/static/ajsim-letter-a.svg") center / contain no-repeat;
  mask: url("/static/ajsim-letter-a.svg") center / contain no-repeat;
}

.app-panel.chat-open.chat-theme-privacy .chat-mode-control {
  border-color: #59377a;
  background: #0b0711;
}

.app-panel.chat-open.chat-theme-privacy .chat-mode-control button.active {
  border-color: #a77cdb;
  background: #38204f;
  color: #e0c8ff;
}

.app-panel.chat-open.chat-theme-privacy .message.outgoing {
  border-color: #a77cdb;
  background: #38204f;
}

.app-panel.chat-open.chat-theme-privacy .message:not(.outgoing):not(.emoji-only) {
  border-color: #59377a;
  background: #1b1028;
}

.app-panel.chat-open.chat-theme-privacy .message-input-row textarea {
  border-color: #c4a2ff;
  background: #f3ecff;
  color: #1d102b;
  caret-color: #59377a;
}

.app-panel.chat-open.chat-theme-privacy .message-input-row textarea::placeholder {
  color: #756681;
  opacity: 1;
}

.app-panel.chat-open.chat-theme-privacy .message-input-row textarea:focus {
  border-color: #a77cdb;
  outline: 2px solid rgba(196, 162, 255, 0.3);
  outline-offset: 1px;
}

.app-panel.chat-open.chat-theme-privacy .privacy-composer-shield {
  color: #59377a;
}

.app-panel.chat-open.chat-theme-privacy .send-button {
  background: #c4a2ff;
  color: #13081f;
}

.app-panel.chat-open.chat-theme-privacy .translate-chip.privacy {
  border-color: #7951a0;
  background: #241436;
  color: #d8bdff;
}

.message-reaction-picker {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  padding: 4px 0 8px;
}

.message-reaction-picker button {
  min-width: 0;
  min-height: 48px;
  padding: 4px;
  border-color: #24496b;
  background: #0a1810;
  font-size: 25px;
}

.message-reaction-picker button.active {
  border-color: #75baff;
  background: #12385d;
}

.chat-theme-privacy .message-reaction-picker button.active {
  border-color: #c4a2ff;
  background: #38204f;
}

.message-reply-quote {
  display: grid;
  width: 100%;
  min-width: min(220px, 58vw);
  margin: 0 0 7px;
  gap: 2px;
  padding: 6px 8px;
  border: 0;
  border-left: 3px solid #75baff;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.24);
  color: var(--text);
  text-align: left;
}

.message-reply-quote.has-thumbnail {
  grid-template-columns: minmax(0, 1fr) 40px;
}

.message-reply-quote.has-thumbnail strong,
.message-reply-quote.has-thumbnail span {
  grid-column: 1;
}

.message-reply-quote strong {
  color: #75baff;
  font-size: 10px;
}

.reply-thumbnail {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(117, 186, 255, 0.5);
  border-radius: 4px;
  object-fit: cover;
}

.message-reply-quote .reply-thumbnail {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
}

.message-reply-quote span {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.chat-theme-privacy .message-reply-quote {
  border-left-color: #c4a2ff;
}

.chat-theme-privacy .message-reply-quote strong {
  color: #c4a2ff;
}

.message-reactions {
  position: absolute;
  z-index: 4;
  left: -15px;
  bottom: -13px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
}

.message.has-reactions {
  margin-bottom: 13px;
}

.message:not(.outgoing).has-reactions {
  margin-left: 8px;
}

.message-reaction-chip {
  min-width: 31px;
  min-height: 25px;
  padding: 2px 7px;
  border: 1px solid #315441;
  border-radius: 999px;
  background: #07110b;
  color: var(--text);
  font-size: 14px;
  line-height: 1;
}

.message-reaction-chip.mine {
  border-color: #75baff;
  background: #102b43;
}

.chat-theme-privacy .message-reaction-chip.mine {
  border-color: #c4a2ff;
  background: #29183c;
}

.message-highlight {
  animation: message-highlight 1.2s ease;
}

@keyframes message-highlight {
  0%, 100% { box-shadow: none; }
  35% { box-shadow: 0 0 0 3px rgba(117, 186, 255, 0.55); }
}

.message.emoji-only,
.message.emoji-only.outgoing {
  border: 0;
  background: transparent;
  padding: 2px 4px;
  font-size: 42px;
  line-height: 1.15;
}

.message.emoji-only .message-sender {
  margin-bottom: 2px;
  font-size: 11px;
}

.message p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message p a {
  color: #8cff9f;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}

.message.has-voice {
  width: min(330px, 82vw);
}

.message.has-media {
  width: min(430px, 88vw);
  max-width: min(430px, 88vw);
  padding: 5px;
  overflow: hidden;
  box-sizing: border-box;
}

.message.has-media.has-reactions {
  overflow: visible;
}

.message.has-media-image:not(.view-once-media) {
  width: fit-content;
  max-width: min(360px, 78vw);
  padding: 0;
  border-radius: 6px;
}

.message.has-media-video {
  width: min(360px, 78vw);
  max-width: min(360px, 78vw);
  padding: 0;
  border-radius: 6px;
}

.chat-media-container {
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 180px;
  min-height: 140px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--muted);
  overflow: hidden;
}

.chat-media {
  display: block;
  width: 100%;
  border-radius: 4px;
  object-fit: contain;
  background: #000;
  -webkit-user-drag: none;
}

.chat-media-container.image {
  min-height: 0;
}

.message.has-media-image:not(.view-once-media) .chat-media-container.image {
  width: fit-content;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  border-radius: 5px;
}

.chat-media-container.image.media-loading {
  min-height: 140px;
}

.chat-media-container.image .chat-media {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: min(34dvh, 320px);
  margin-inline: auto;
  object-position: center;
}

.message.has-media-image:not(.view-once-media) .chat-media-container.image .chat-media {
  max-width: min(360px, 78vw);
  margin: 0;
  border-radius: 5px;
}

.chat-media-container.video .chat-media {
  max-height: min(34dvh, 320px);
  cursor: zoom-in;
}
.message.has-media-image:not(.view-once-media),
.message.has-media-video:not(.view-once-media) {
  width: min(180px, 42vw);
  max-width: min(180px, 42vw);
}

.message.has-media-image:not(.view-once-media) .chat-media-container.image,
.message.has-media-video:not(.view-once-media) .chat-media-container.video {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
}

.message.has-media-image:not(.view-once-media) .chat-media-container.image .chat-media,
.message.has-media-video:not(.view-once-media) .chat-media-container.video .chat-media {
  position: absolute;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  object-fit: contain;
  object-position: 50% 50%;
}

.chat-media-container.video.video-preview-ready::after {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  background: rgba(4, 16, 27, 0.72);
  color: #fff;
  content: "\25B6";
  font-size: 23px;
  line-height: 1;
  pointer-events: none;
  transform: translate(-50%, -50%);
}


.chat-media-container.image .chat-media {
  cursor: zoom-in;
}

.message.view-once-media {
  width: min(230px, 64vw);
  max-width: min(230px, 64vw);
  min-height: 0;
  padding: 0;
  border-radius: 6px;
}

.view-once-placeholder {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 0;
  background: transparent;
}

.view-once-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 62px;
  padding: 8px 12px 8px 9px;
  color: var(--text);
  text-align: left;
  visibility: visible;
  opacity: 1;
}

.view-once-card.actionable {
  cursor: pointer;
}

.view-once-card.actionable:focus-visible {
  outline: 2px solid #75baff;
  outline-offset: -2px;
  border-radius: 4px;
}

.view-once-card[aria-busy="true"] {
  opacity: 0.65;
  pointer-events: none;
}

.view-once-label {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}

.view-once-icon,
.view-once-menu-icon {
  display: grid;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 50%;
  font-weight: 800;
}

.view-once-icon {
  width: 32px;
  height: 32px;
  color: #75baff;
  font-size: 12px;
  letter-spacing: -1px;
}

.view-once-menu-icon {
  width: 28px;
  height: 28px;
  font-size: 14px;
}

.media-viewer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.96);
}

.media-viewer-dialog {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.media-viewer-dialog img,
.media-viewer-dialog video {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.media-viewer-dialog img {
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
  cursor: zoom-in;
  transform-origin: center;
  will-change: transform;
}

.media-viewer-dialog img.zoomed {
  cursor: grab;
}

.media-viewer-dialog img.dragging {
  cursor: grabbing;
}

.media-viewer-dialog video {
  width: 100%;
  height: 100%;
  background: #000;
}

.media-viewer-dialog video[hidden] {
  display: none;
}

.media-viewer-backdrop.profile-avatar-viewer {
  background: rgba(0, 0, 0, 0.72);
}

.profile-avatar-viewer .media-viewer-dialog {
  width: min(52vmin, 360px);
  height: auto;
  aspect-ratio: 1;
}

.profile-avatar-viewer .media-viewer-dialog img {
  width: 100%;
  height: 100%;
  border: 2px solid var(--accent);
  border-radius: 16px;
  object-fit: cover;
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.5);
}

.profile-avatar-viewer .media-viewer-close {
  top: -18px;
  right: -18px;
}

.media-viewer.view-once,
.media-viewer.view-once img {
  -webkit-touch-callout: none;
  user-select: none;
}

.media-viewer-watermark {
  position: absolute;
  inset: 8%;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  align-items: center;
  justify-items: center;
  overflow: hidden;
  pointer-events: none;
}

.media-viewer-watermark[hidden] {
  display: none;
}

.media-viewer-watermark span {
  max-width: 150px;
  color: rgba(255, 255, 255, 0.24);
  font-size: clamp(9px, 2.4vw, 13px);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  transform: rotate(-24deg);
}

.media-viewer-close {
  position: absolute;
  z-index: 2;
  top: 0;
  right: 0;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  min-width: 46px;
  padding: 0;
  border-radius: 50%;
  background: rgba(7, 17, 11, 0.88);
  color: #fff;
  font-size: 32px;
  line-height: 1;
}

.media-viewer-dialog p {
  position: absolute;
  z-index: 2;
  bottom: 4px;
  margin: 0;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(7, 17, 11, 0.88);
  color: #fff;
  font-size: 12px;
  text-align: center;
}

body.media-viewer-open {
  overflow: hidden;
}

.chat-media-container.media-unavailable {
  min-height: 90px;
  padding: 16px;
  text-align: center;
}

.message.has-poll {
  width: min(430px, 88vw);
}

.message.has-event {
  width: min(460px, 90vw);
}

.message.has-event.has-receipt:not(.emoji-only) {
  padding: 10px 12px;
}

.poll-card {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.poll-question {
  padding-right: 18px;
  overflow-wrap: anywhere;
  font-size: 16px;
}

.poll-translated,
.poll-summary {
  color: var(--muted);
  font-size: 10px;
}

.poll-options {
  display: grid;
  gap: 7px;
}

.poll-option {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 8px 10px;
  border-color: #2c643c;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  text-align: left;
}

.poll-option.selected {
  border-color: var(--accent);
  background: rgba(82, 209, 105, 0.13);
}

.poll-option-indicator {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid #4c7658;
  border-radius: 4px;
  color: #031008;
  background: transparent;
  font-weight: 900;
}

.poll-option.selected .poll-option-indicator {
  border-color: var(--accent);
  background: var(--accent);
}

.poll-option-label {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.poll-option-count {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.poll-voters {
  grid-column: 2 / -1;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[dir="rtl"] .poll-option {
  text-align: right;
}

.event-card {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.event-name {
  padding-right: 18px;
  overflow-wrap: anywhere;
  font-size: 18px;
}

.event-time {
  display: grid;
  gap: 2px;
  padding: 9px 10px;
  border-left: 3px solid #74b7ff;
  border-radius: 4px;
  background: rgba(116, 183, 255, 0.1);
}

.event-time-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
}

.event-time-row > span {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.event-time span,
.event-guests,
.event-response-summary {
  color: var(--muted);
  font-size: 11px;
}

.event-description {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.event-location {
  overflow-wrap: anywhere;
  font-weight: 700;
}

.event-location a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.event-location-card {
  border: 1px solid rgba(116, 183, 255, 0.45);
  border-radius: 6px;
  background: rgba(3, 16, 29, 0.45);
}

.event-response-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  padding: 7px 0 0;
}

.event-response-actions button {
  position: relative;
  display: grid;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  padding: 9px 8px;
  font-size: 12px;
  white-space: nowrap;
  text-align: center;
}

.event-response-label {
  display: block;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.event-response-count {
  position: absolute;
  z-index: 1;
  top: -10px;
  right: -8px;
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.event-response-actions button.selected {
  border-color: #74b7ff;
  background: rgba(116, 183, 255, 0.18);
  color: #d9ecff;
}

.event-response-summary {
  line-height: 1.5;
}

.event-response-summary summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 700;
}

.event-response-summary p {
  display: grid;
  gap: 1px;
  margin: 7px 0 0 16px;
}

.event-response-summary p strong {
  color: var(--text);
  font-size: 11px;
}

.event-response-summary p span {
  overflow-wrap: anywhere;
}

.event-cancelled {
  color: #ff7a70;
}

@media (max-width: 520px) {
  .event-date-grid {
    grid-template-columns: 1fr;
  }
}

.voice-message-player {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 46px;
}

.voice-play-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  padding: 0;
  border-radius: 50%;
  font-size: 17px;
}

.voice-message-player audio {
  width: 100%;
  min-width: 0;
  height: 36px;
}

.voice-message-meta {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 11px;
}

.voice-transcript-label {
  display: block;
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

@media (max-width: 520px) {
  .message-input-row {
    gap: 5px;
  }
}

.message.has-location {
  width: min(360px, 88vw);
  max-width: min(360px, 88vw);
  padding: 0;
  overflow: hidden;
  box-sizing: border-box;
}

.message.has-location.outgoing {
  padding: 0;
}

.location-message {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 88px;
  padding: 12px 30px 12px 12px;
  box-sizing: border-box;
  color: var(--text);
  text-decoration: none;
}

.location-message-pin {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #174626;
  font-size: 23px;
}

.location-message > span:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.location-message strong {
  font-size: 16px;
  line-height: 1.25;
}

.location-message small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
}

.location-message-action {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.message-edited {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  text-align: right;
}

.message-receipt {
  position: absolute;
  right: 9px;
  bottom: 6px;
  display: inline-flex;
  align-items: center;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  text-align: right;
  user-select: none;
}

[dir="rtl"] .message-receipt {
  right: auto;
  left: 9px;
}

.message.emoji-only.has-receipt {
  padding-bottom: 17px;
}

.message.has-media .message-receipt {
  right: 6px;
  bottom: 6px;
  padding: 3px 5px;
  border-radius: 999px;
  background: rgba(3, 12, 8, 0.72);
  color: #d7e3d9;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

[dir="rtl"] .message.has-media .message-receipt {
  right: auto;
  left: 6px;
}

.message-receipt.delivered,
.message-receipt.read {
  color: #63ef87;
}

.message.has-media .message-receipt.delivered,
.message.has-media .message-receipt.read {
  color: #63ef87;
}

.message-receipt.pending {
  color: var(--muted);
  letter-spacing: 1px;
}

#edit-message-input {
  width: 100%;
  min-height: 110px;
  resize: vertical;
}

.settings-list {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: grid;
  gap: 12px;
}

.settings-row,
.settings-card {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid #173a59;
  border-radius: 8px;
  padding: 14px;
  background: rgba(0, 0, 0, 0.18);
}

.live-translation-setting {
  gap: 10px;
}

.translation-mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 12px;
  padding: 5px;
  border: 1px solid #173a59;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
}

.translation-mode-tabs button {
  min-width: 0;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.translation-mode-tabs button.active {
  border-color: rgba(92, 255, 116, 0.55);
  background: rgba(92, 255, 116, 0.12);
  color: var(--text);
}

.quick-translation-card {
  position: relative;
  overflow: hidden;
  gap: 12px;
  border-color: rgba(92, 255, 116, 0.55);
  background:
    radial-gradient(circle at top right, rgba(92, 255, 116, 0.14), transparent 42%),
    rgba(7, 17, 11, 0.92);
}

.quick-translation-card .live-translation-launch-icon {
  overflow: hidden;
  font-size: 0.95rem;
  letter-spacing: -0.08em;
  white-space: nowrap;
}

.quick-translation-card > p,
.quick-translation-card > small {
  margin: 0;
}

.quick-translation-languages {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 8px;
}

.quick-translation-languages label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.quick-translation-swap {
  width: 46px;
  min-width: 46px;
  height: 46px;
  padding: 0;
  font-size: 1.35rem;
}

#quick-translation-input,
#quick-translation-output {
  width: 100%;
  min-height: 116px;
  resize: vertical;
}

#quick-translation-output {
  border-color: rgba(92, 255, 116, 0.4);
  background: rgba(92, 255, 116, 0.06);
}

.quick-translation-primary-actions,
.quick-translation-result-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.quick-translation-result {
  display: grid;
  gap: 8px;
}

.quick-translation-result[hidden] {
  display: none;
}

.quick-translation-result-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#quick-translation-voice.recording {
  border-color: #ff6b6b;
  background: rgba(255, 82, 82, 0.16);
  color: #ffb1b1;
}

.quick-translation-privacy {
  color: var(--muted);
  line-height: 1.45;
}

@media (max-width: 520px) {
  .quick-translation-card {
    gap: 10px;
    padding: 12px;
  }

  .quick-translation-card .live-translation-launch-heading {
    gap: 10px;
  }

  .quick-translation-languages {
    grid-template-columns: minmax(0, 1fr) 42px minmax(0, 1fr);
    gap: 5px;
  }

  .quick-translation-swap {
    width: 42px;
    min-width: 42px;
  }

  .quick-translation-result-actions {
    grid-template-columns: 1fr;
  }

  #quick-translation-input,
  #quick-translation-output {
    height: 112px;
    min-height: 112px;
  }
}

body.app-active.translation-active .app-header {
  display: none;
}

body.app-active.translation-active .app-panel:not(.chat-open) {
  grid-template-rows: minmax(0, 1fr) auto;
}

body.app-active.translation-active #view-contacts {
  padding: 10px 14px max(14px, env(safe-area-inset-bottom));
  scroll-padding-bottom: 96px;
}

.quick-translation-workspace {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(760px, 100%);
  min-height: 100%;
  margin: 0 auto;
}

.quick-translation-languages {
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
}

.quick-translation-languages label {
  display: block;
}

.quick-translation-languages select {
  width: 100%;
  height: 52px;
  min-height: 52px;
  border: 1px solid #245b34;
  border-radius: 14px;
  padding: 0 14px;
  background: rgba(4, 13, 8, 0.86);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  text-align: center;
}

.quick-translation-swap {
  width: 44px;
  min-width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  font-size: 1.35rem;
}

.quick-translation-canvas {
  position: relative;
  flex: 1 1 300px;
  min-height: 240px;
}

#quick-translation-input,
#quick-translation-output {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 240px;
  border: 1px solid rgba(77, 156, 232, 0.42);
  border-radius: 20px;
  padding: 22px 52px 22px 20px;
  resize: none;
  background: rgba(7, 17, 11, 0.72);
  color: var(--text);
  font-size: clamp(1.35rem, 4.7vw, 1.8rem);
  line-height: 1.4;
}

#quick-translation-input::placeholder {
  color: var(--muted);
  opacity: 0.9;
}

.quick-translation-input-clear {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 1.5rem;
}

.quick-translation-result {
  flex: 0 0 auto;
}

.quick-translation-result #quick-translation-output {
  height: auto;
  min-height: 150px;
  padding-right: 20px;
  border-color: rgba(92, 255, 116, 0.5);
  background: rgba(92, 255, 116, 0.07);
}

.quick-translation-workspace:has(.quick-translation-result:not([hidden])) .quick-translation-canvas,
.quick-translation-workspace:has(.quick-translation-result:not([hidden])) #quick-translation-input {
  min-height: 150px;
}

.quick-translation-workspace:has(.quick-translation-result:not([hidden])) > .quick-translation-action-dock {
  display: none;
}

.quick-translation-result-actions {
  margin-top: 8px;
}

.quick-translation-result-actions > button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 10px 6px;
  line-height: 1.2;
  text-align: center;
}

#quick-translation-status {
  min-height: 20px;
  margin: 0;
  text-align: center;
}

.quick-translation-action-dock {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 8px;
  padding: 8px 4px 4px;
  background: linear-gradient(180deg, transparent, var(--panel) 28%);
}

.quick-translation-action {
  display: grid;
  grid-template-rows: 56px minmax(2.3em, auto);
  align-content: end;
  justify-items: center;
  gap: 5px;
  width: 100%;
  min-width: 0;
  min-height: 88px;
  padding: 4px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.15;
  text-align: center;
}

.quick-translation-action > span:last-child {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 2.3em;
}

.quick-translation-action-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 1px solid #245b34;
  border-radius: 50%;
  background: rgba(92, 255, 116, 0.08);
  font-size: 1.25rem;
}

.quick-translation-mic .quick-translation-action-icon {
  width: 56px;
  height: 56px;
  border-color: var(--accent);
  background: var(--accent);
  color: #021006;
  font-size: 1.55rem;
}

#quick-translation-voice.recording .quick-translation-action-icon {
  border-color: #ff6b6b;
  background: #ff6b6b;
  color: #260303;
}

.quick-translation-privacy {
  flex: 0 0 auto;
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.quick-translation-privacy summary {
  cursor: pointer;
  list-style-position: inside;
}

.quick-translation-privacy small {
  display: block;
  max-width: 520px;
  padding-top: 5px;
}

.translation-mode-back {
  justify-self: start;
  width: auto;
}

body.app-active.quick-translation-keyboard-open #user-bottom-nav {
  display: none;
}

body.app-active.quick-translation-keyboard-open .app-panel:not(.chat-open) {
  grid-template-rows: minmax(0, 1fr);
}

body.app-active.quick-translation-keyboard-open #view-contacts {
  padding-bottom: 8px;
  scroll-padding-bottom: 8px;
}

body.app-active.quick-translation-keyboard-open .quick-translation-privacy {
  display: none;
}

body.app-active.quick-translation-keyboard-open .quick-translation-action-dock {
  position: static;
  bottom: auto;
  flex: 0 0 auto;
}

body.app-active.quick-translation-keyboard-open .quick-translation-canvas,
body.app-active.quick-translation-keyboard-open #quick-translation-input {
  min-height: 150px;
}

html:not([data-app-variant="desktop"]) body.app-active.quick-translation-keyboard-open #view-contacts.ios-keyboard-guard-active {
  position: fixed;
  z-index: 65;
  inset: var(--ios-keyboard-viewport-top, 0px) 0 auto;
  width: 100%;
  height: var(--ios-keyboard-viewport-height, 100dvh);
  padding: 8px 10px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-padding-bottom: 16px;
  -webkit-overflow-scrolling: touch;
  background: var(--panel);
}

html:not([data-app-variant="desktop"]) body.app-active.quick-translation-keyboard-open #view-contacts.ios-keyboard-guard-active .quick-translation-workspace {
  height: auto;
  min-height: 100%;
  overflow: visible;
}

html:not([data-app-variant="desktop"]) body.app-active.quick-translation-keyboard-open #view-contacts.ios-keyboard-guard-active .quick-translation-canvas {
  flex: 0 0 auto;
  min-height: clamp(230px, 34dvh, 320px);
}

html:not([data-app-variant="desktop"]) body.app-active.quick-translation-keyboard-open #view-contacts.ios-keyboard-guard-active #quick-translation-input {
  height: 100%;
  min-height: clamp(230px, 34dvh, 320px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

@media (max-width: 520px) {
  body.app-active.translation-active #view-contacts {
    padding: 8px 10px max(10px, env(safe-area-inset-bottom));
  }

  .quick-translation-workspace {
    gap: 8px;
  }

  .quick-translation-languages select {
    height: 48px;
    min-height: 48px;
    padding-inline: 8px;
  }

  .quick-translation-canvas,
  #quick-translation-input {
    min-height: clamp(230px, 42dvh, 390px);
  }

  #quick-translation-input,
  #quick-translation-output {
    height: 100%;
    padding: 18px 46px 18px 16px;
  }

  .quick-translation-result-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

html:not([data-app-variant="desktop"]) body.app-active.translation-active:not(.quick-translation-keyboard-open) #view-contacts {
  padding-bottom: max(106px, calc(90px + env(safe-area-inset-bottom)));
  scroll-padding-bottom: max(106px, calc(90px + env(safe-area-inset-bottom)));
}

html:not([data-app-variant="desktop"]) body.app-active.translation-active:not(.quick-translation-keyboard-open) .quick-translation-action-dock {
  position: static;
  bottom: auto;
}

.live-translation-workspace {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(760px, 100%);
  min-height: 100%;
  margin: 0 auto;
}

.live-translation-languages select:disabled {
  opacity: 1;
  cursor: default;
  -webkit-text-fill-color: var(--text);
}

.live-translation-language-link {
  display: grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--accent);
  font-size: 1.35rem;
  font-weight: 800;
}

.live-translation-canvas {
  display: grid;
  flex: 1 1 300px;
  place-items: center;
  min-height: 300px;
  overflow-y: auto;
  border: 1px solid rgba(77, 156, 232, 0.42);
  border-radius: 20px;
  padding: 20px;
  background: rgba(7, 17, 11, 0.72);
}

.live-translation-intro {
  display: grid;
  justify-items: center;
  gap: 12px;
  max-width: 480px;
  text-align: center;
}

.live-translation-intro strong {
  font-size: clamp(1.25rem, 4.5vw, 1.75rem);
}

.live-translation-intro p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.live-translation-workspace-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 1px solid #245b34;
  border-radius: 50%;
  background: rgba(92, 255, 116, 0.08);
  color: var(--accent);
  font-size: 2rem;
  font-weight: 800;
}

.live-translation-canvas:has(.live-translation-result:not([hidden])) .live-translation-intro {
  display: none;
}

.live-translation-result {
  display: grid;
  justify-items: center;
  width: 100%;
  max-width: 420px;
  padding: 0;
  border: 0;
  background: transparent;
  align-items: center;
  text-align: center;
}

.live-translation-result img {
  width: min(280px, 100%);
  border-radius: 14px;
  background: #fff;
  padding: 10px;
}

.live-translation-result p {
  margin: 0;
  line-height: 1.45;
}

#live-translation-status {
  min-height: 20px;
  margin: 0;
  text-align: center;
}

.live-translation-action-dock {
  grid-template-columns: minmax(0, 150px);
  justify-content: center;
}

@media (max-width: 520px) {
  .live-translation-workspace {
    gap: 8px;
  }

  .live-translation-canvas {
    min-height: clamp(300px, 50dvh, 440px);
    padding: 16px;
  }
}

.button-link {
  display: inline-flex;
  justify-content: center;
  border: 1px solid var(--accent, #5cff74);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: inherit;
  font-weight: 700;
  text-decoration: none;
}

.settings-card {
  display: grid;
  align-items: stretch;
  justify-content: stretch;
}

.settings-card p {
  margin-bottom: 0;
}

.settings-card > span:first-child {
  color: var(--accent);
  font-size: 1.05rem;
  font-weight: 800;
}

.settings-card > strong {
  font-size: 0.92rem;
  font-weight: 700;
}

.settings-card select {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid #245b34;
  border-radius: 6px;
  background: #020805;
  color: var(--text);
  font: inherit;
}

.settings-security-group {
  width: 100%;
  min-width: 0;
  border-bottom: 1px solid var(--separator);
}

.settings-security-group > summary {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 18px 34px 18px 2px;
  cursor: pointer;
  list-style: none;
}

.settings-security-group > summary::-webkit-details-marker {
  display: none;
}

.settings-security-group > summary::after {
  position: absolute;
  top: 50%;
  right: 6px;
  content: "⌄";
  color: var(--accent-strong);
  font-size: 1.35rem;
  transform: translateY(-55%);
}

.settings-security-group[open] > summary::after {
  transform: translateY(-35%) rotate(180deg);
}

.settings-security-group > summary > span {
  color: var(--accent-strong);
  font-size: 1.05rem;
  font-weight: 800;
}

.settings-security-group > summary > small {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.settings-security-options {
  display: grid;
  gap: 0;
  padding-left: 12px;
  border-left: 3px solid rgba(35, 139, 209, 0.3);
}

.settings-security-options > .settings-card:last-child {
  border-bottom: 0;
}

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

.blocked-contact-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(36, 91, 52, 0.9);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
}

.blocked-contact-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.blocked-contact-row button {
  width: auto;
  min-height: 40px;
  padding: 8px 12px;
}

.business-blocked-visitor-row {
  grid-template-columns: 46px minmax(0, 1fr) auto;
}

.business-blocked-visitor-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.business-blocked-visitor-copy strong,
.business-blocked-visitor-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.business-blocked-visitor-copy span {
  color: var(--muted);
  font-size: 11px;
}

.blocked-contacts-view-hint {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(36, 91, 52, 0.7);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.18);
}

.blocked-contacts-empty {
  margin: 0;
  color: var(--muted);
}

.recovery-code-panel {
  display: grid;
  gap: 14px;
  margin-top: 6px;
  padding: 14px;
  border: 1px solid #245b34;
  border-radius: 6px;
  background: #06100a;
}

.recovery-code-panel[hidden] {
  display: none;
}

.recovery-code-panel label {
  margin-top: 0;
}

.admin-recovery-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}

.admin-recovery-card h4,
.admin-recovery-card p {
  margin: 0;
}

.admin-recovery-card > strong {
  color: var(--muted);
}

#admin-recovery-pin-step,
#admin-recovery-result {
  display: grid;
  gap: 10px;
}

#admin-recovery-words {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  padding: 10px;
  border: 1px solid #327746;
  border-radius: 8px;
  background: #07170c;
  user-select: all;
}

#recovery-pin-step {
  display: grid;
  gap: 10px;
}

#recovery-pin-step input,
#recovery-pin-step button,
#recovery-code-result button,
#close-recovery-code-button {
  width: 100%;
}

#close-recovery-code-button {
  margin-top: 2px;
}

#recovery-code-output {
  display: block;
  padding: 14px;
  border: 1px solid #327746;
  border-radius: 6px;
  background: #07170c;
  color: var(--accent);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.7;
  overflow-wrap: anywhere;
  user-select: all;
}

#recovery-code-result {
  display: grid;
  gap: 10px;
}

#recovery-code-result[hidden] {
  display: none;
}

.recovery-first-backdrop {
  z-index: 1200;
  align-items: center;
}

.recovery-first-dialog {
  width: min(520px, 100%);
  max-height: min(760px, calc(100dvh - 32px));
  gap: 12px;
  padding: 20px;
  overflow-y: auto;
}

.recovery-first-kicker {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
}

.recovery-first-dialog h3 {
  margin: -4px 0 0;
  font-size: clamp(22px, 5.6vw, 30px);
  line-height: 1.15;
  text-align: left;
}

.recovery-first-dialog > p {
  margin: 0;
  line-height: 1.45;
}

.recovery-first-warning {
  padding: 11px 12px;
  border: 1px solid #8d702d;
  border-radius: 8px;
  background: #211a08;
  color: #ffe3a0;
  font-size: 14px;
  font-weight: 650;
}

#recovery-first-words {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  min-height: 0;
  padding: 10px;
  border: 1px solid #327746;
  border-radius: 8px;
  background: #07170c;
  color: var(--accent);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.25;
  user-select: all;
}

.recovery-first-word {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 7px 8px;
  border-radius: 6px;
  background: rgba(120, 255, 145, 0.07);
  overflow-wrap: anywhere;
}

.recovery-first-word-number {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-align: right;
}

.recovery-first-word-value {
  min-width: 0;
  color: var(--accent);
  font-weight: 750;
}

.recovery-first-confirm {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 13px;
  border: 1px solid #327746;
  border-radius: 8px;
  background: #0a1b10;
  color: var(--text);
  cursor: pointer;
}

.recovery-first-confirm input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  opacity: 0;
}

.recovery-first-checkmark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  flex: 0 0 32px;
  border: 2px solid #6de780;
  border-radius: 6px;
  background: #020503;
  color: #020503;
}

.recovery-first-confirm input:checked + .recovery-first-checkmark {
  background: var(--accent);
}

.recovery-first-confirm input:checked + .recovery-first-checkmark::after {
  content: "\2713";
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}

.recovery-first-confirm input:focus-visible + .recovery-first-checkmark {
  outline: 3px solid rgba(86, 240, 111, 0.4);
  outline-offset: 2px;
}

.recovery-first-confirm-text {
  display: block;
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
}

.recovery-first-confirm-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.recovery-first-confirm-copy strong {
  color: var(--text);
  font-size: 15px;
  line-height: 1.25;
}

#recovery-first-status:empty {
  display: none;
}

.recovery-first-actions {
  grid-template-columns: 1fr;
}

.recovery-first-actions button {
  width: 100%;
}

.media-report-confirm-backdrop {
  z-index: 1300;
  align-items: center;
  padding-top: calc(16px + env(safe-area-inset-top));
}

.media-report-confirm-dialog {
  width: min(460px, 100%);
  max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.media-report-confirm-dialog p {
  margin: 4px 0 10px;
}

body.media-report-open .message-footer {
  visibility: hidden;
  pointer-events: none;
}

.security-log {
  display: grid;
  gap: 14px;
  margin-top: 6px;
  padding: 14px;
  border: 1px solid #245b34;
  border-radius: 6px;
  background: #06100a;
}

.security-log[hidden] {
  display: none;
}

#security-log-list {
  display: grid;
  gap: 8px;
}

.security-log-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  min-width: 0;
  padding: 12px;
  border: 1px solid #173c24;
  border-radius: 6px;
  background: #020805;
}

.security-log-entry:last-child {
  border-bottom: 1px solid #173c24;
}

.security-log-entry strong {
  min-width: 0;
  line-height: 1.35;
  overflow-wrap: break-word;
  word-break: normal;
}

.security-log-entry time {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.security-log-entry > span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 14px;
}

#close-security-log-button {
  width: 100%;
}

.security-log-empty {
  color: var(--muted);
}

.install-steps {
  display: grid;
  gap: 8px;
  margin: 2px 0 0;
  padding-left: 24px;
  color: var(--text);
}

.install-steps li {
  padding-left: 3px;
  line-height: 1.4;
}

[dir="rtl"] .install-steps {
  padding-right: 24px;
  padding-left: 0;
}

.settings-row span,
.settings-card span {
  color: var(--muted);
}

.settings-row strong {
  text-align: right;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--text);
}

.toggle-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.danger-card {
  border-color: #5c2a24;
}

.danger-card button {
  border-color: #ff7a6b;
  background: #351812;
}

.voice-message-transcript {
  position: relative;
  grid-column: 1 / -1;
  display: grid;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  padding-right: 30px;
  border-top: 1px solid var(--separator, rgba(117, 186, 255, 0.24));
}

.voice-message-transcript small {
  color: var(--accent);
  font-weight: 800;
}

.voice-message-transcript p {
  margin: 0;
}

.voice-transcript-dismiss {
  position: absolute;
  top: 5px;
  right: -3px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #d44848;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  opacity: 0.75;
}

.voice-transcript-dismiss:active,
.voice-transcript-dismiss:focus-visible {
  background: rgba(212, 72, 72, 0.1);
  color: #bf2929;
  opacity: 1;
}

.confirm-box {
  display: grid;
  gap: 10px;
  border: 1px solid #5c2a24;
  border-radius: 8px;
  padding: 12px;
  background: rgba(53, 24, 18, 0.35);
}

.confirm-box p {
  margin: 0;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.bottom-nav {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(36, 73, 107, 0.7);
  background: rgba(3, 8, 5, 0.96);
  backdrop-filter: blur(12px);
}

.bottom-nav[hidden] {
  display: none !important;
}

.bottom-nav.admin-bottom-nav {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

#user-bottom-nav:has(#business-nav-item[hidden]) {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.secondary-button {
  background: transparent;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.support-section-heading {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: start;
  justify-content: stretch;
  column-gap: 12px;
  row-gap: 8px;
}

.support-back-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  border-radius: 50%;
  color: var(--accent);
  font-size: 26px;
  line-height: 1;
}

.support-close-action {
  grid-column: 2;
  justify-self: start;
  margin: 0;
}

.section-heading h3,
.section-heading .eyebrow,
.admin-thread-panel h4,
.admin-conversation-panel h4 {
  margin: 0;
}

.support-thread-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.compact-button {
  width: auto;
  padding: 8px 12px;
}

.support-view {
  min-height: 0;
}

body.app-active .app-panel:not(.chat-open) #view-support:not([hidden]) {
  overflow: hidden;
}

/* Let the complete support conversation scroll on phones. A nested message
   scroller can otherwise leave the composer behind the fixed navigation. */
@media (max-width: 899px) {
  html:not([data-app-variant="desktop"]) body.app-active .app-panel:not(.chat-open) #view-support:not([hidden]) {
    overflow-y: auto;
    overscroll-behavior-y: contain;
  }

  html:not([data-app-variant="desktop"]) .support-user-layout {
    height: auto;
    min-height: 100%;
    grid-template-rows: auto auto auto auto;
    overflow: visible;
  }

  html:not([data-app-variant="desktop"]) .support-user-layout .support-message-list {
    height: auto;
    min-height: 220px;
    overflow: visible;
  }

  body.app-active.support-keyboard-open #user-bottom-nav {
    display: none !important;
  }

  body.app-active.support-keyboard-open .app-panel:not(.chat-open) #view-support:not([hidden]) {
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    scroll-padding-bottom: max(20px, env(safe-area-inset-bottom));
  }
}

.support-user-layout,
.admin-support-layout,
.admin-layout {
  display: grid;
  gap: 14px;
  min-height: 100%;
}

.support-user-layout {
  height: 100%;
  min-height: 0;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 10px;
  overflow: hidden;
}

.support-user-layout .support-section-heading {
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  margin: 0;
}

.support-user-layout .support-section-heading .eyebrow {
  display: none;
}

.support-user-layout .support-section-heading h3 {
  font-size: clamp(19px, 4vw, 23px);
  line-height: 1.2;
}

.support-user-layout .support-back-button {
  width: 40px;
  height: 40px;
  min-width: 40px;
  font-size: 23px;
}

.support-user-layout .support-close-action {
  grid-column: 3;
  justify-self: end;
  padding: 7px 10px;
  font-size: 13px;
  white-space: nowrap;
}

.account-settings-card {
  align-content: start;
}

.inline-settings-form {
  display: grid;
  gap: 9px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.inline-settings-actions,
.section-heading-actions {
  display: flex;
  gap: 8px;
}

.inline-settings-actions > button {
  flex: 1;
}

#view-settings.inline-settings-keyboard-open {
  padding-bottom: calc(var(--inline-settings-keyboard-inset, 0px) + 28px);
  scroll-padding-bottom: calc(var(--inline-settings-keyboard-inset, 0px) + 28px);
}

.support-settings-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.settings-card .support-settings-button > span:first-child {
  color: inherit;
}

.settings-button-badge {
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #031008;
  font-size: 12px;
  font-weight: 900;
}

.settings-scope-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 16px;
  padding: 5px;
  border: 1px solid var(--separator);
  border-radius: 10px;
  background: var(--surface-subtle);
}

.settings-scope-tabs button {
  min-height: 46px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.settings-scope-tabs button.active {
  border-color: var(--accent);
  background: var(--panel-2);
  color: var(--text);
}

.business-settings-panel,
.business-settings-content {
  display: grid;
  gap: 14px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

#view-settings,
#settings-business-panel,
#business-settings-enabled,
#business-settings-content,
#business-settings-content > * {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

#view-settings,
#settings-business-panel,
#business-settings-enabled {
  overflow-x: clip;
}

.business-settings-panel[hidden],
.settings-list[hidden] {
  display: none;
}

.business-settings-content > :first-child {
  margin-top: 0;
}

.business-beta-shell {
  display: grid;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.business-inbox-site-heading {
  width: 100%;
}

.business-inbox-site {
  position: relative;
  display: block;
  width: 100%;
  margin: 0;
}

.business-inbox-site select {
  width: 100%;
  margin: 0;
}

.business-inbox-site-count {
  position: absolute;
  top: 50%;
  right: 44px;
  display: grid;
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  place-items: center;
  transform: translateY(-50%);
  border-radius: 999px;
  border: 1px solid var(--accent);
  color: var(--accent-strong);
  background: var(--panel);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
}

.business-inbox-site-count.unread {
  color: #fff;
  border-color: #1aa653;
  background: #1fbd60;
}

.business-inbox-access-state[hidden] {
  display: none;
}

#business-enabled-panel > #business-widget-inbox-card {
  margin-top: 0;
}

.business-access-state {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.business-access-state.enabled {
  border-color: var(--accent);
  color: var(--accent);
}

.business-profile-form,
.business-workspace-card,
.business-sites-card {
  display: grid;
  gap: 14px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(8, 20, 12, 0.72);
}

.business-workspace-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.business-workspace-toolbar label,
.business-workspace-create-form label,
.business-site-form label {
  margin: 0;
}

.business-workspace-create-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--separator);
}

.business-workspace-create-form[hidden] {
  display: none;
}

.business-site-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.business-site-form[hidden] {
  display: none;
}

.business-site-form-actions {
  display: grid;
  gap: 8px;
}

.business-site-list {
  display: grid;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.business-site-row {
  display: grid;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--separator);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.12);
}

.business-site-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.business-site-settings {
  padding-top: 12px;
  border-top: 1px solid var(--separator);
}

.business-site-settings[hidden],
.business-site-opening-hours[hidden] {
  display: none;
}

.business-site-settings-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.business-site-settings-form > label {
  margin: 0;
}

.business-site-setting-toggle,
.business-site-settings-actions {
  grid-column: 1 / -1;
}

.business-site-setting-toggle {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 9px;
}

.business-site-setting-toggle input {
  width: auto;
  margin: 0;
}

.business-site-opening-hours {
  display: grid;
  grid-column: 1 / -1;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--separator);
  border-radius: 8px;
}

.business-site-hours-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(100px, 140px) minmax(100px, 140px);
  align-items: center;
  gap: 10px;
}

.business-site-hours-row label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin: 0;
  text-transform: capitalize;
}

.business-site-hours-row label input {
  width: auto;
  margin: 0;
}

.business-site-settings-actions {
  display: grid;
  gap: 8px;
}

.business-site-settings-actions button {
  width: 100%;
}

.business-site-settings-actions span {
  display: block;
  min-height: 18px;
  text-align: center;
}

.business-site-summary > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.business-site-install {
  display: grid;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding-top: 12px;
  border-top: 1px solid var(--separator);
}

.business-site-install[hidden] {
  display: none;
}

.business-site-install p {
  margin: 0;
  color: var(--muted);
}

.business-site-install-code {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--separator);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  word-break: break-all;
  font: 600 12px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.business-site-install .secondary-button {
  justify-self: start;
}

.business-site-row span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.business-site-state {
  flex: 0 0 auto;
  color: var(--accent) !important;
  font-size: 12px;
  font-weight: 800;
}

.business-profile-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.business-profile-heading h4,
.business-profile-heading p {
  margin: 0;
}

.business-profile-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

.business-profile-form input,
.business-profile-form textarea,
.business-profile-form select {
  width: 100%;
  margin: 0;
  background: #07110a;
}

.business-profile-form textarea {
  min-height: 104px;
  resize: vertical;
}

.business-profile-status {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

.business-profile-status.saved {
  color: var(--accent);
}

.business-link-card,
.business-inbox-card {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(8, 20, 12, 0.72);
}

.business-link-card h4,
.business-link-card p,
.business-inbox-card h4,
.business-inbox-card p {
  margin: 0;
}

.business-link-result {
  display: grid;
  grid-template-columns: minmax(128px, 176px) minmax(0, 1fr);
  align-items: center;
  gap: 18px;
}

.business-link-result img {
  width: 100%;
  padding: 8px;
  border-radius: 6px;
  background: #fff;
}

.business-link-details {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.business-link-details code {
  display: block;
  overflow-wrap: anywhere;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--accent);
  background: #050b07;
}

.business-workspace-card {
  position: relative;
  margin-top: 0;
}

.business-settings-add-menu {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 8;
}

.business-settings-add-button {
  display: grid;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  place-items: center;
  border-radius: 999px;
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
}

.business-settings-add-popover {
  position: absolute;
  top: 50px;
  right: 0;
  display: grid;
  width: min(270px, calc(100vw - 58px));
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
}

.business-settings-add-popover[hidden] {
  display: none;
}

.business-settings-add-popover button {
  width: 100%;
  min-height: 44px;
  justify-content: flex-start;
  text-align: left;
}

.business-workspace-toolbar {
  grid-template-columns: minmax(0, 1fr);
}

.business-workspace-toolbar label,
.business-workspace-toolbar select {
  width: 100%;
}

.business-workspace-toolbar label > span {
  display: flex;
  min-height: 44px;
  align-items: center;
  padding-right: 56px;
}

.business-settings-section-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--separator);
}

.business-settings-section-tabs[hidden] {
  display: none;
}

.business-settings-section-tabs button {
  min-height: 48px;
  border-color: var(--line);
  background: transparent;
  color: var(--muted);
}

.business-settings-section-tabs button.active {
  border-color: var(--accent);
  background: var(--panel-2);
  color: var(--text);
}

.business-company-panel {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.business-company-panel[hidden] {
  display: none;
}

.business-company-panel > * {
  margin-top: 0;
}

.business-connect-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
}

.business-connect-heading p,
.business-connect-heading strong {
  margin: 0;
}

.business-connect-heading strong {
  color: var(--text);
  overflow-wrap: anywhere;
}

.business-connect-heading > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.business-connect-heading .icon-close-button {
  flex: 0 0 auto;
}

.business-connect-grid {
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  align-items: start;
}

.business-install-card h4,
.business-install-card p {
  margin: 0;
}

.business-install-list,
.business-install-row,
.business-install-actions {
  display: grid;
  gap: 10px;
  max-width: 100%;
  min-width: 0;
}

.business-install-row {
  padding-top: 14px;
  border-top: 1px solid var(--separator);
}

.business-install-row:first-child {
  padding-top: 0;
  border-top: 0;
}

.business-install-row > div:first-child {
  display: grid;
  gap: 3px;
}

.business-install-row > div:first-child span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.business-install-actions {
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
}

.business-inbox-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.business-conversation-count {
  display: grid;
  min-width: 34px;
  min-height: 34px;
  place-items: center;
  border: 1px solid #4aa3df;
  border-radius: 50%;
  color: #87c8f5;
  font-weight: 900;
}

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

.business-conversation-list .contact-row {
  min-height: 64px;
}

.business-conversation-row {
  border-color: #296e9e;
  background: rgba(9, 34, 53, 0.72);
}

.business-widget-conversation-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px 10px;
  width: 100%;
  padding: 12px;
  border-color: var(--separator);
  background: rgba(0, 0, 0, 0.12);
  color: var(--text);
  text-align: left;
}

.business-widget-avatar {
  display: grid;
  grid-row: 1;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid var(--accent);
  border-radius: 50%;
  background: var(--surface-subtle);
  color: var(--accent);
  font-size: 17px;
  font-weight: 900;
}

.business-widget-conversation-content {
  display: grid;
  grid-column: 2;
  gap: 5px;
  min-width: 0;
}

.business-widget-conversation-row.unread {
  border-color: #4aa3df;
  background: rgba(9, 34, 53, 0.72);
}

.business-widget-conversation-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.business-widget-conversation-heading strong,
.business-widget-conversation-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.business-widget-conversation-heading strong {
  color: var(--text);
  font-size: 18px;
  line-height: 1.2;
}

.business-widget-conversation-heading span,
.business-widget-conversation-row time,
.business-widget-conversation-preview,
.business-widget-thread header span,
.business-widget-message time {
  color: var(--muted);
  font-size: 11px;
}

.business-widget-conversation-preview {
  min-width: 0;
}

.business-widget-conversation-row time {
  grid-column: 3;
  grid-row: 1;
  align-self: start;
  min-width: 38px;
  font-size: 10px;
  text-align: right;
}

.business-widget-thread {
  display: grid;
  gap: 12px;
}

.business-widget-thread[hidden] {
  display: none;
}

.business-widget-thread header {
  position: relative;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.business-widget-thread-identity {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.business-widget-thread-back,
.business-widget-thread-menu {
  display: grid;
  width: 44px;
  height: 44px;
  min-width: 44px;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  background: var(--surface-subtle);
  color: var(--text);
  font-size: 25px;
}

.business-widget-thread-avatar {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--accent);
  font-size: 17px;
  font-weight: 900;
}

.business-widget-thread-actions {
  position: absolute;
  z-index: 5;
  top: calc(100% + 6px);
  right: 0;
  display: grid;
  width: min(260px, calc(100vw - 24px));
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--separator);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

.business-widget-thread-actions[hidden] {
  display: none !important;
}

.business-widget-thread-actions button {
  min-width: 0;
  white-space: nowrap;
}

.business-widget-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 220px;
  max-height: 48vh;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--separator);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.16);
}

.business-widget-message {
  display: grid;
  gap: 4px;
  max-width: min(82%, 520px);
  padding: 9px 11px;
  border: 1px solid var(--separator);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.business-widget-message.outgoing {
  align-self: flex-end;
  border-color: #327cb0;
  background: rgba(36, 126, 188, 0.2);
}

.business-widget-message p {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.business-widget-reply-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.business-widget-reply-form textarea {
  min-height: 44px;
  max-height: 112px;
  margin: 0;
  padding: 10px 15px;
  overflow-y: auto;
  resize: none;
  border-radius: 22px;
  line-height: 1.35;
}

.business-widget-send {
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  border-radius: 50%;
  font-size: 28px;
  line-height: 1;
}

.business-contact-label {
  padding: 3px 6px;
  border: 1px solid #4aa3df;
  border-radius: 4px;
  color: #87c8f5;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.business-feature-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.business-feature-list article {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(8, 20, 12, 0.72);
}

.business-feature-list span,
.business-locked-panel p,
.business-phase-note {
  color: var(--muted);
}

@media (max-width: 620px) {
  .business-connect-grid {
    grid-template-columns: 1fr;
  }

  .business-workspace-toolbar,
  .business-site-form {
    grid-template-columns: 1fr;
  }

  .business-site-summary {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .business-site-settings-form {
    grid-template-columns: 1fr;
  }

  .business-site-settings-form > * {
    grid-column: 1;
  }

  .business-site-hours-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .business-site-hours-row label {
    grid-column: 1 / -1;
  }

  .business-site-hours-row > input {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .business-site-settings-button,
  .business-site-install-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .business-link-result {
    grid-template-columns: 1fr;
  }

  .business-link-result img {
    width: min(176px, 100%);
    justify-self: center;
  }

  .business-install-actions {
    grid-template-columns: 1fr;
  }

  .business-install-actions button {
    width: 100%;
  }

  .business-widget-reply-form {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  body.app-active.business-website-thread-open .shell {
    grid-template-rows: minmax(0, 1fr);
    gap: 0;
    padding: 0;
  }

  body.app-active.business-website-thread-open .hero,
  body.app-active.business-website-thread-open .app-header,
  body.app-active.business-website-thread-open .app-status {
    display: none;
  }

  body.app-active.business-website-thread-open .bottom-nav {
    display: none;
  }

  body.app-active.business-website-thread-open .app-panel:not(.chat-open) .app-view {
    padding: 0;
    overflow: hidden;
  }

  #view-business.website-thread-open .business-beta-shell,
  #view-business.website-thread-open #business-enabled-panel,
  #view-business.website-thread-open #business-widget-inbox-card,
  #view-business.website-thread-open .business-widget-thread {
    height: 100%;
    min-height: 0;
  }

  #view-business.website-thread-open .business-beta-shell > .section-heading,
  #view-business.website-thread-open #business-enabled-panel > :not(#business-widget-inbox-card),
  #view-business.website-thread-open #business-widget-inbox-card > .business-inbox-heading,
  #view-business.website-thread-open #business-widget-inbox-card > .business-conversation-list {
    display: none;
  }

  #view-business.website-thread-open #business-widget-inbox-card {
    position: fixed;
    z-index: 80;
    inset: var(--ios-keyboard-viewport-top, 0px) 0 auto;
    width: 100%;
    height: var(--ios-keyboard-viewport-height, 100dvh);
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: var(--panel);
  }

  #view-business.website-thread-open .business-widget-thread {
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    gap: 0;
  }

  #view-business.website-thread-open .business-widget-thread header {
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    gap: 8px;
    padding: max(8px, env(safe-area-inset-top)) 10px 8px;
    border-bottom: 1px solid var(--separator);
    background: var(--panel);
  }

  #view-business.website-thread-open .business-widget-thread header > div:not(.business-widget-thread-actions) {
    overflow: hidden;
  }

  #view-business.website-thread-open .business-widget-thread header strong,
  #view-business.website-thread-open .business-widget-thread header span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #view-business.website-thread-open .business-widget-thread header .business-widget-thread-actions {
    top: calc(100% - 2px);
    right: 8px;
  }

  #view-business.website-thread-open .business-widget-thread-actions button {
    min-height: 44px;
    width: 100%;
  }

  #view-business.website-thread-open .business-widget-messages {
    min-height: 0;
    max-height: none;
    padding: 14px 10px 20px;
    border: 0;
    border-radius: 0;
    background: var(--panel-2);
  }

  #view-business.website-thread-open .business-widget-message {
    padding: 10px 12px;
    border-radius: 16px;
  }

  #view-business.website-thread-open .business-widget-reply-form {
    align-items: center;
    gap: 8px;
    padding: 8px 10px max(8px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--separator);
    background: var(--panel);
  }

  #view-business.website-thread-open .business-widget-reply-form textarea {
    min-height: 44px;
    max-height: 112px;
    padding: 10px 15px;
    border-radius: 22px;
    resize: none;
  }

  #view-business.website-thread-open .business-widget-reply-form .business-widget-send {
    min-height: 44px;
    padding: 0;
  }

  #view-business.website-thread-open .business-widget-status {
    min-height: 0;
    margin: 0;
    padding: 5px 10px;
    background: var(--panel);
    text-align: center;
  }

  #view-business.website-thread-open .business-widget-status:empty {
    display: none;
  }
}

.business-locked-panel {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: rgba(8, 20, 12, 0.5);
}

.business-locked-panel p,
.business-phase-note {
  margin-bottom: 0;
}

.support-message-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 220px;
  max-height: 48vh;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #020704;
}

.support-user-layout .support-message-list {
  width: 100%;
  min-height: 0;
  max-height: none;
  height: 100%;
  overscroll-behavior: contain;
}

.support-message {
  align-self: flex-start;
  max-width: min(78%, 620px);
  padding: 9px 11px;
  border: 1px solid #24496b;
  border-radius: 6px;
  background: #09160d;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.support-message.outgoing {
  align-self: flex-end;
  border-color: #4cd768;
  background: #103d1d;
}

.support-message small {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
}

.support-ai-intro {
  margin: 0;
  padding: 8px 10px;
  border-left: 3px solid var(--accent);
  background: #07120a;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.support-ai-message {
  border-color: #3776a8;
  background: #071b2b;
}

.support-ai-feedback {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(147, 192, 226, 0.28);
}

.support-ai-feedback > span:first-child {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 0.88rem;
}

.support-ai-feedback button {
  min-height: 36px;
}

.support-ai-status {
  color: #b9d8c0;
}

.support-ai-status.escalated {
  color: #f0cf78;
}

.support-timeout-choice {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--panel-2);
}

.support-timeout-choice p {
  margin: 0;
}

.support-timeout-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.support-timeout-actions button {
  width: 100%;
}

.support-empty {
  margin: auto;
  color: var(--muted);
  text-align: center;
}

.support-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.support-composer textarea {
  min-height: 48px;
  max-height: 120px;
  margin: 0;
  resize: vertical;
  border-color: #89a990;
  background: #edf5ef;
  color: #08120b;
  caret-color: #103d1d;
}

.support-composer textarea::placeholder {
  color: #5b6f60;
  opacity: 1;
}

.support-composer textarea:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(120, 255, 145, 0.28);
  outline-offset: 1px;
}

.support-composer button {
  width: auto;
  min-height: 48px;
}

.support-user-layout .support-composer {
  grid-template-columns: minmax(0, 1fr) auto;
  flex: 0 0 auto;
}

.support-user-layout .support-composer textarea {
  resize: none;
}

.support-user-layout .support-composer button {
  width: auto;
}

.admin-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.admin-metric {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #08120b;
}

.admin-metric span,
.admin-system span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.admin-metric strong {
  display: block;
  margin-top: 3px;
  font-size: 20px;
}

.admin-system {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.admin-server-view .admin-layout,
.admin-settings-view .admin-layout,
.admin-media-view .admin-layout {
  align-content: start;
  min-height: 0;
}

.admin-server-view .admin-metrics,
.admin-server-view .admin-system {
  align-items: start;
}

.admin-server-view .admin-metric {
  min-height: 72px;
}

.admin-translation-usage {
  display: grid;
  gap: 12px;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.admin-translation-usage > header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 1fr);
  gap: 16px;
  align-items: end;
}

.admin-translation-usage h4,
.admin-translation-usage h5,
.admin-translation-usage p {
  margin: 0;
}

.admin-cost-warnings { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid #d99b35; border-radius: 8px; background: rgba(217, 155, 53, 0.12); color: #ffd98e; }
.admin-cost-warnings[hidden] { display: none; }

.admin-speech-usage {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.admin-speech-usage > header {
  display: block;
}

.admin-speech-usage .admin-metrics {
  grid-auto-rows: 92px;
  align-items: stretch;
}

.admin-speech-usage .admin-metric {
  min-height: 92px;
  height: 100%;
}

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

.admin-translation-breakdowns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.admin-translation-breakdowns > section {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  max-height: 284px;
  padding: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #08120b;
}

.admin-translation-breakdowns h5 {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.admin-translation-breakdowns > section > div,
.admin-translation-breakdowns > section > p {
  min-height: 0;
  max-height: 236px;
  padding-right: 10px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.admin-translation-breakdowns > section > div::-webkit-scrollbar,
.admin-translation-breakdowns > section > p::-webkit-scrollbar {
  width: 7px;
}

.admin-translation-breakdowns > section > div::-webkit-scrollbar-thumb,
.admin-translation-breakdowns > section > p::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 45%, transparent);
}

.admin-translation-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-top: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
}

.admin-translation-row:first-child {
  border-top: 0;
}

.admin-translation-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-translation-row span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.admin-media-reports {
  display: grid;
  gap: 8px;
}

.admin-media-reports h4 {
  margin: 8px 0 0;
}

.admin-media-report {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #08120b;
}

.admin-media-report > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.admin-media-report span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.admin-media-actions {
  display: grid;
  gap: 6px;
}

.admin-media-actions button {
  white-space: nowrap;
}

.admin-banned-accounts {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.admin-banned-accounts h4,
.admin-banned-accounts p {
  margin: 0;
}

#admin-banned-accounts {
  display: grid;
  gap: 8px;
}

.admin-ban-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #08120b;
}

.admin-ban-row > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.admin-ban-row span,
.admin-ban-status {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.admin-ban-status {
  padding: 7px 9px;
  border: 1px solid var(--danger, #b04a4a);
  border-radius: 5px;
  text-align: center;
}

.admin-media-evidence {
  grid-column: 1 / -1;
  display: grid;
  min-height: 140px;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #020704;
}

.admin-media-evidence img,
.admin-media-evidence video {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 360px;
  object-fit: contain;
}

.admin-support-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.6fr);
  gap: 12px;
  min-height: 340px;
}

.admin-thread-panel,
.admin-conversation-panel {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
}

.support-thread-list {
  display: grid;
  gap: 6px;
  max-height: 54vh;
  overflow-y: auto;
}

.support-thread-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  width: 100%;
  padding: 10px;
  text-align: left;
  background: #07110b;
}

.support-thread-button.active {
  border-color: var(--accent);
  background: #103d1d;
}

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

.support-thread-button b {
  min-width: 20px;
  color: var(--accent);
  text-align: right;
}

@media (max-width: 720px) {
  .admin-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .admin-translation-usage > header,
  .admin-speech-usage > header,
  .admin-translation-breakdowns {
    grid-template-columns: 1fr;
  }

  .admin-support-grid {
    grid-template-columns: 1fr;
  }

  .support-composer {
    grid-template-columns: minmax(0, 1fr);
  }

  .support-composer button {
    width: 100%;
  }

  .bottom-nav {
    gap: 2px;
    padding-right: 6px;
    padding-left: 6px;
  }

  .nav-item {
    padding-right: 4px;
    padding-left: 4px;
    font-size: 12px;
  }
}

.nav-item {
  position: relative;
}

.nav-notification-badge {
  position: absolute;
  top: 5px;
  left: calc(50% + 10px);
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 2px solid #030805;
  border-radius: 999px;
  background: var(--accent);
  color: #020503;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.app-panel.chat-open .bottom-nav {
  display: none;
}

.app-panel.chat-open .app-view {
  padding: 0;
  overflow: hidden;
}

body.chat-active .hero {
  display: none;
}

body.chat-active .shell {
  display: block;
  width: min(960px, 100%);
  height: 100dvh;
  padding: 0;
}

.app-panel.chat-open {
  grid-template-rows: auto minmax(0, 1fr);
  width: 100%;
  max-width: 100vw;
  height: 100dvh;
  min-height: 0;
  margin: 0;
  overflow: hidden;
}

.app-panel.chat-open .app-header {
  --chat-header-leading-size: 44px;
  display: grid;
  grid-template-columns: var(--chat-header-leading-size) minmax(0, 1fr) auto;
  min-height: 62px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: rgba(3, 8, 5, 0.98);
}

/* Keep mobile navigation and native call controls on fixed physical sides in RTL. */
html[dir="rtl"]:not([data-app-variant="desktop"]) .app-panel.chat-open .app-header,
html[dir="rtl"]:not([data-app-variant="desktop"]) .app-panel.chat-open .app-header-title {
  direction: ltr;
}

html[dir="rtl"]:not([data-app-variant="desktop"]) .app-panel.chat-open .app-header-title h2,
html[dir="rtl"]:not([data-app-variant="desktop"]) .app-panel.chat-open .chat-header-status {
  direction: rtl;
  text-align: right;
}

.app-panel.chat-open .app-header .eyebrow {
  display: none;
}

.app-panel.chat-open .app-header h2 {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  font-size: 18px;
}

.app-panel.chat-open .app-header-actions {
  flex: 0 0 auto;
  gap: 8px;
}

.app-panel.chat-open .app-status {
  position: absolute;
  z-index: 20;
  top: calc(62px + env(safe-area-inset-top));
  left: 50%;
  max-width: calc(100% - 24px);
  min-height: 0;
  padding: 6px 10px;
  border: 1px solid #24496b;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -8px);
  transition: opacity 160ms ease, transform 160ms ease;
  background: #07110b;
  font-size: 12px;
  text-align: center;
}

.app-panel.chat-open .app-status.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.app-panel.chat-open .app-status.chat-alert {
  width: max-content;
  max-width: min(440px, calc(100% - 28px));
  padding: 10px 14px;
  border-color: #e2a43b;
  border-radius: 14px;
  background: #17202a;
  color: #ffffff;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.4;
  text-wrap: balance;
}

.app-panel.chat-open #view-chats,
.app-panel.chat-open .vault-layout {
  height: 100%;
  min-height: 0;
}

.app-panel.chat-open .chat-layout,
.app-panel.chat-open .chat-create-tools {
  display: none;
}

.app-panel.chat-open .vault-layout {
  position: relative;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0;
  margin: 0;
}

.chat-file-drop-overlay {
  position: absolute;
  z-index: 30;
  inset: 12px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  border: 2px dashed var(--accent);
  border-radius: 20px;
  background: rgba(3, 12, 8, 0.94);
  color: var(--text);
  pointer-events: none;
}

.chat-file-drop-overlay[hidden] {
  display: none;
}

.chat-file-drop-overlay span {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--accent);
  color: #031007;
  font-size: 40px;
  line-height: 1;
}

.chat-file-drop-overlay strong {
  font-size: 16px;
  text-align: center;
}

.chat-details-panel {
  height: 100%;
  min-height: 0;
  overflow: auto;
  padding: 0 0 calc(20px + env(safe-area-inset-bottom));
  background: var(--panel);
  -webkit-overflow-scrolling: touch;
}

.chat-details-panel[hidden],
.chat-details-content[hidden] {
  display: none;
}

.chat-details-subheading h4,
.chat-details-setting h4 {
  margin: 0;
}

.chat-details-subback {
  display: grid;
  place-items: center;
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
}

.chat-details-back svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.chat-details-content {
  display: grid;
  gap: 0;
  padding: 12px 18px 24px;
}

.chat-details-entry {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 58px;
  border: 0;
  border-bottom: 1px solid var(--separator);
  border-radius: 0;
  padding: 10px 4px;
  background: transparent;
  color: var(--text);
  text-align: start;
}

.chat-details-entry > span:first-child {
  color: var(--accent);
  font-size: 21px;
  text-align: center;
}

.chat-details-setting {
  display: grid;
  gap: 10px;
  padding: 18px 4px;
  border-bottom: 1px solid var(--separator);
}

.chat-details-setting .chat-translation-toggle {
  justify-self: stretch;
  justify-content: flex-start;
  min-height: 56px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-subtle);
  font-size: 15px;
  font-weight: 700;
}

.chat-details-setting .chat-translation-toggle input {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  margin: 0;
}

.chat-translation-setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  align-items: center;
  gap: 12px;
}

.chat-details-setting .translate-chip {
  width: 100%;
  max-width: none;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-details-setting .privacy-retention-control {
  justify-content: space-between;
}

.chat-details-group-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 18px 4px;
}

.chat-details-subheading {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.chat-details-subheading h4 {
  font-size: 18px;
}

#conversation-search-input {
  min-height: 48px;
}

#conversation-search-count {
  min-height: 22px;
  margin: 10px 2px;
}

.conversation-search-results,
.shared-content-results {
  display: grid;
  min-width: 0;
}

.conversation-search-result {
  display: grid;
  gap: 4px;
  min-width: 0;
  border: 0;
  border-bottom: 1px solid var(--separator);
  border-radius: 0;
  padding: 12px 4px;
  background: transparent;
  color: var(--text);
  text-align: start;
}

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

.conversation-search-result time {
  color: var(--muted);
  font-size: 11px;
}

.shared-content-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 12px;
  padding: 3px;
  border: 1px solid var(--separator);
  border-radius: 9px;
  background: var(--surface-subtle);
}

.shared-content-tabs button {
  min-width: 0;
  min-height: 38px;
  padding: 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.shared-content-tabs button.active {
  background: var(--accent);
  color: #06111d;
}

.shared-content-results:has(.shared-media-card) {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.shared-media-card {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 0;
  border: 1px solid var(--separator);
  background: var(--surface-subtle);
  color: var(--text);
  font-size: 10px;
  text-align: start;
}

.shared-media-preview {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  overflow: hidden;
  font-size: 28px;
}

.shared-media-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.shared-file-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 9px 10px;
  border: 1px solid var(--separator);
  border-radius: 7px;
  background: var(--surface-subtle);
  color: var(--text);
  text-align: start;
}

.shared-file-icon {
  font-size: 28px;
  text-align: center;
}

.shared-file-details {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.shared-file-details strong,
.shared-file-details small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shared-file-details small {
  color: var(--muted);
  font-size: 11px;
}

.shared-media-card > span:last-child {
  overflow: hidden;
  padding: 0 6px 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shared-link-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--separator);
}

.shared-link-card a {
  overflow: hidden;
  color: #75baff;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shared-link-card button {
  width: auto;
  min-height: 34px;
  padding: 5px 8px;
  font-size: 10px;
}

.chat-details-empty {
  margin: 30px auto;
  color: var(--muted);
  text-align: center;
}

.message-search-highlight {
  animation: message-search-highlight 1.8s ease;
}

@keyframes message-search-highlight {
  0%, 45% { box-shadow: 0 0 0 4px rgba(117, 186, 255, 0.8); }
  100% { box-shadow: none; }
}

.app-panel.chat-open .message-list {
  min-height: 0;
  max-height: none;
  border: 0;
  border-radius: 0;
  padding: 12px 12px 22px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.nav-item {
  display: grid;
  align-self: center;
  justify-items: center;
  align-content: center;
  gap: 4px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  padding: 8px 6px;
  height: 58px;
  min-height: 58px;
  max-height: 58px;
  overflow: hidden;
}

.nav-item svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item span {
  font-size: 12px;
}

.nav-item.active {
  color: var(--accent);
  background: rgba(18, 56, 93, 0.72);
  border-color: #24496b;
}

@media (max-width: 700px) {
  .shell {
    width: 100%;
    max-width: 100%;
    padding: 0 10px;
  }

  body.app-active .shell {
    padding: max(8px, env(safe-area-inset-top)) 10px max(8px, env(safe-area-inset-bottom));
  }

  body.chat-active .shell {
    padding: 0;
  }

  .hero,
  .panel {
    padding: 18px 14px;
    margin-bottom: 10px;
  }

  .hero {
    align-items: center;
    flex-direction: row;
    padding: 12px 14px;
  }

  .language-switcher {
    width: auto;
    font-size: 0;
  }

  .language-switcher select {
    width: 64px;
    min-width: 64px;
    font-size: 13px;
  }

  .hero h1 {
    font-size: 24px;
  }

  .app-panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: calc(100vh - 20px);
    margin-bottom: 0;
  }

  .app-header {
    padding: 16px 14px 10px;
  }

  .app-panel:not(.chat-open) .app-header {
    min-height: 52px;
    padding: 10px 14px;
  }

  .app-status {
    padding: 10px 14px 0;
  }

  .app-view {
    padding: 14px 14px 96px;
  }

  .app-panel.chat-open {
    border: 0;
    border-radius: 0;
  }

  .app-panel.chat-open .app-header {
    --chat-header-leading-size: 38px;
    grid-template-columns: var(--chat-header-leading-size) minmax(0, 1fr) auto;
    gap: 3px;
    padding-right: 12px;
    padding-left: 6px;
  }

  .app-panel.chat-open .app-header-title:has(.chat-header-avatar:not([hidden])) {
    column-gap: 5px;
  }

  .app-panel.chat-open .app-header h2 {
    font-size: 16px;
    letter-spacing: -0.25px;
  }

  .app-panel.chat-open .chat-back-button {
    width: var(--chat-header-leading-size);
    height: var(--chat-header-leading-size);
  }

  .app-panel.chat-open .app-header-actions {
    gap: 3px;
  }

  .app-panel.chat-open .header-call-button {
    width: var(--chat-header-leading-size);
    height: var(--chat-header-leading-size);
    min-width: var(--chat-header-leading-size);
  }

  .app-panel.chat-open .header-create-action {
    display: none;
  }

  .app-panel.chat-open .header-connection-status {
    display: none;
  }

  .chat-toolbar {
    min-height: 46px;
    padding: 5px 8px;
  }

  .chat-toolbar .chat-mode-control {
    width: 100%;
    flex: 1 1 100%;
  }

  .chat-toolbar .chat-mode-control button {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .message {
    max-width: 86%;
    padding: 8px 10px;
  }

  .message.emoji-only,
  .message.emoji-only.outgoing {
    font-size: 44px;
  }

  .app-panel.chat-open .message-list {
    padding: 10px 8px 22px;
  }

  input,
  textarea,
  button {
    min-width: 0;
  }

  .bottom-nav {
    left: 0;
    right: 0;
  }

  .group-member-row {
    align-items: center;
    grid-template-columns: minmax(82px, 1fr) auto;
    gap: 6px;
  }

  .contact-request-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .contact-request-row button {
    width: 100%;
  }

.contact-request-row .remove-contact-request {
  position: absolute;
  top: 7px;
  right: 7px;
    width: 34px;
    min-width: 34px;
  }

  .group-member-actions {
    display: flex;
    width: auto;
  }

  .contact-request-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .contact-request-actions {
    grid-column: 1 / -1;
  }


  .recovery-code-panel,
  .security-log {
    margin-right: 0;
    margin-left: 0;
    padding: 12px;
  }

  .security-log-entry {
    grid-template-columns: minmax(0, 1fr);
  }

  .security-log-entry time,
  .security-log-entry > span {
    grid-column: 1;
    white-space: normal;
  }

  .support-section-heading {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .support-section-heading h3 {
    font-size: clamp(22px, 7vw, 28px);
    line-height: 1.15;
  }

  body.app-active .app-panel:not(.chat-open) #view-support:not([hidden]) {
    padding: 10px 10px 12px;
    overflow: hidden;
  }

  .support-user-layout .support-section-heading {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    column-gap: 9px;
  }

  .support-user-layout .support-section-heading h3 {
    font-size: 19px;
  }

  .support-user-layout .support-back-button {
    width: 38px;
    height: 38px;
    min-width: 38px;
  }

  .support-user-layout .support-close-action {
    max-width: 104px;
    padding: 6px 8px;
    font-size: 12px;
    white-space: normal;
  }

  .support-user-layout .support-message-list {
    padding: 9px;
  }

  .support-user-layout .support-message {
    max-width: 88%;
  }

  .support-user-layout .support-composer {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .support-user-layout .support-composer button {
    width: auto;
    min-width: 82px;
    padding-right: 10px;
    padding-left: 10px;
  }
}

/* Mobile support composer: keep the input available independently of nested
   scrolling and the fixed application navigation. This final override lives
   after all responsive rules so older support layout rules cannot win. */
@media (max-width: 899px) {
  html:not([data-app-variant="desktop"]) body.app-active .app-panel:not(.chat-open) #view-support:not([hidden]) {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(190px + env(safe-area-inset-bottom)) !important;
    scroll-padding-bottom: calc(190px + env(safe-area-inset-bottom)) !important;
  }

  html:not([data-app-variant="desktop"]) #view-support .support-user-layout {
    display: block;
    height: auto !important;
    min-height: 100%;
    overflow: visible !important;
  }

  html:not([data-app-variant="desktop"]) #view-support .support-user-layout > * + * {
    margin-top: 10px;
  }

  html:not([data-app-variant="desktop"]) #view-support .support-user-layout .support-message-list {
    height: auto !important;
    min-height: 220px;
    max-height: none !important;
    overflow: visible !important;
  }

  html:not([data-app-variant="desktop"]) #view-support .support-user-layout .support-composer {
    position: fixed;
    z-index: 69;
    right: 10px;
    bottom: calc(78px + env(safe-area-inset-bottom));
    left: 10px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
    box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.18);
  }

  html:not([data-app-variant="desktop"]) body.support-keyboard-open #view-support .support-user-layout .support-composer {
    bottom: max(8px, env(safe-area-inset-bottom));
  }

  /* Native iOS keeps fixed elements relative to the layout viewport while the
     keyboard reduces visualViewport. Use the viewport values maintained by
     keyboard-viewport.js to dock the composer directly above the keyboard. */
  html:not([data-app-variant="desktop"]) body.support-keyboard-open #view-support.ios-keyboard-guard-active .support-user-layout .support-composer {
    top: calc(var(--ios-keyboard-viewport-top, 0px) + var(--ios-keyboard-viewport-height, 100dvh) - 8px);
    bottom: auto;
    transform: translateY(-100%);
  }
}

.native-share-dialog {
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100dvh - 28px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, auto) auto;
  gap: 0;
  border-radius: 20px;
}

.native-share-backdrop {
  place-items: end center;
  padding: 12px;
  padding-top: calc(12px + env(safe-area-inset-top));
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}

.native-share-dialog .group-panel-header > div {
  flex: 1 1 auto;
  min-width: 0;
  max-width: calc(100% - 46px);
  overflow: hidden;
}

.native-share-dialog h3,
.native-share-file {
  margin: 0;
}

.native-share-dialog .group-panel-header {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  padding: 14px 16px 12px;
}

.native-share-dialog .group-panel-header h3 {
  font-size: 1.12rem;
}

.native-share-dialog .icon-close-button {
  width: 34px;
  height: 34px;
  min-width: 34px;
  font-size: 24px;
}

.native-share-file {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.native-share-search {
  width: auto;
  margin: 12px 14px 8px;
  min-height: 46px;
}

.native-share-contact-list {
  min-height: 0;
  max-height: min(42dvh, 360px);
  overflow: auto;
  display: grid;
  grid-auto-rows: min-content;
  align-content: start;
  gap: 0;
  padding: 2px 14px 8px;
  scrollbar-gutter: stable;
}

.native-share-contact {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  margin: 0;
  min-height: 40px;
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel-soft);
  cursor: pointer;
}

.native-share-contact:has(input:checked) {
  border-color: var(--accent);
  background: rgba(33, 150, 243, 0.14);
}

.native-share-contact input {
  width: 20px;
  height: 20px;
  margin: 0;
}

.native-share-contact .contact-avatar {
  width: 32px;
  height: 32px;
}

.native-share-dialog footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}

.native-share-selection {
  min-width: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.3;
}

.native-share-send {
  width: auto;
  min-width: 150px;
  min-height: 44px;
  padding: 9px 14px;
  white-space: nowrap;
}

@media (max-width: 430px) {
  .native-share-dialog footer {
    grid-template-columns: minmax(0, 1fr);
  }

  .native-share-send {
    width: 100%;
  }
}

.chat-file-download {
  width: min(360px, 100%);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 10px;
  align-items: center;
  padding: 12px 14px;
  text-align: left;
}

.chat-file-download > span {
  grid-row: 1 / 3;
  font-size: 1.7rem;
}

.chat-file-download strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-file-download small {
  opacity: 0.72;
}

.message.has-media-file {
  width: min(180px, 42vw);
  max-width: min(180px, 42vw);
  padding: 0;
}

.message.has-media-video.has-receipt:not(.emoji-only),
.message.has-media-file.has-receipt:not(.emoji-only) {
  padding: 0;
}

.message.has-media-file .chat-media-container.file {
  min-width: 0;
  min-height: 0;
  background: transparent;
  overflow: visible;
}

.message.has-media-file .chat-file-download {
  width: 100%;
  min-height: 62px;
  padding: 9px 34px 9px 10px;
  border-radius: 6px;
}

.message.has-media-file .chat-file-download strong {
  font-size: 0.82rem;
}

.message.has-media-file .chat-file-download small {
  font-size: 0.72rem;
}

.message.has-contact {
  width: min(250px, 72vw);
  max-width: min(250px, 72vw);
  padding: 4px;
}

.message.outgoing.has-contact.has-receipt {
  padding: 0;
}

.message.outgoing.has-contact .shared-contact-card {
  min-height: 100%;
  padding: 10px 34px 24px 10px;
  border: 0;
  border-radius: 7px;
}

.shared-contact-card {
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 7px 10px;
  width: 100%;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--separator);
  border-radius: 7px;
  background: var(--panel);
}

.shared-contact-card .contact-avatar {
  position: relative;
  width: 46px;
  height: 46px;
  font-size: 17px;
}

.shared-contact-card-info {
  align-self: center;
  gap: 1px;
}

.shared-contact-card-info strong {
  color: var(--text);
  font-size: 15px;
  line-height: 1.25;
}

.shared-contact-card-info small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.shared-contact-card button {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 750;
}

/* Keep every regular conversation item on one shared visual rhythm. Polls and
   events intentionally keep their wider, data-heavy cards. System notices and
   standalone emoji remain content-sized as well. */
.message:not(.emoji-only):not(.has-poll):not(.has-event) {
  width: min(250px, 72vw);
  max-width: min(250px, 72vw);
  box-sizing: border-box;
}

.message.has-media-image:not(.view-once-media),
.message.has-media-video:not(.view-once-media),
.message.has-media-file,
.message.view-once-media,
.message.has-voice,
.message.has-location,
.message.has-contact {
  width: min(250px, 72vw);
  max-width: min(250px, 72vw);
}

/* Final appearance overrides live after the legacy rules during the gradual UI migration. */
:root {
  --bg: #02070d;
  --panel: #07111d;
  --panel-2: #0a1b2b;
  --line: #24496b;
  --text: #edf6ff;
  --muted: #a9bbca;
  --accent: #75baff;
  --accent-strong: #3f9dea;
  --surface-subtle: rgba(117, 186, 255, 0.07);
  --separator: rgba(117, 186, 255, 0.2);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f9fc;
  --panel: #ffffff;
  --panel-2: #eef5fb;
  --line: #c7d9e8;
  --text: #102235;
  --muted: #637789;
  --accent: #238bd1;
  --accent-strong: #0877bd;
  --surface-subtle: rgba(35, 139, 209, 0.07);
  --separator: rgba(31, 78, 113, 0.16);
}

/* Light appearance also applies before login and during account onboarding. */
:root[data-theme="light"] body {
  background: var(--bg);
  color: var(--text);
}

:root[data-theme="light"] .hero,
:root[data-theme="light"] .panel,
:root[data-theme="light"] .app-panel {
  border-color: var(--line);
  background: var(--panel);
  color: var(--text);
}

:root[data-theme="light"] .hero .app-brand span,
:root[data-theme="light"] .panel h1,
:root[data-theme="light"] .panel h2,
:root[data-theme="light"] .panel h3,
:root[data-theme="light"] .panel strong {
  color: var(--text);
}

:root[data-theme="light"] label,
:root[data-theme="light"] .muted,
:root[data-theme="light"] .language-switcher {
  color: var(--muted);
}

:root[data-theme="light"] input,
:root[data-theme="light"] textarea,
:root[data-theme="light"] select {
  border-color: #a9cbe2;
  background: #ffffff;
  color: var(--text);
}

:root[data-theme="light"] input::placeholder,
:root[data-theme="light"] textarea::placeholder {
  color: #71869a;
  opacity: 1;
}

:root[data-theme="light"] button {
  border-color: #8ebfde;
  background: var(--panel-2);
  color: var(--text);
}

:root[data-theme="light"] .contact-app-choice {
  border-color: #a9cbe2;
  background: #f3f8fc;
}

:root[data-theme="light"] .contact-store-button {
  border-color: #238bd1;
  background: #e3f1fb;
  color: #102235;
}

:root[data-theme="light"] .contact-open-app {
  border-color: #0877bd;
  background: #238bd1;
  color: #fff;
}

:root[data-theme="light"] #login-button,
:root[data-theme="light"] #signup-button,
:root[data-theme="light"] #register-button,
:root[data-theme="light"] #recover-account-button,
:root[data-theme="light"] #welcome-create-account {
  border-color: #0877bd;
  background: #238bd1;
  color: #ffffff;
}

:root[data-theme="light"] .login-options-toggle {
  border-top-color: var(--separator);
  background: transparent;
  color: var(--text);
}

body.app-active .shell {
  width: 100%;
  max-width: 100%;
  gap: 0;
  padding: 0;
}

body.app-active .hero,
body.app-active .app-panel {
  width: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: var(--panel);
}

body.app-active .hero {
  padding: max(12px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 12px max(18px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--separator);
}

body.app-active .app-header,
body.app-active .bottom-nav,
body.app-active .app-view {
  border-color: var(--separator);
  background: var(--panel);
}

body.app-active #view-chats {
  padding-right: 0;
  padding-left: 0;
}

body.app-active #view-chats .chat-create-tools,
body.app-active #view-chats .chat-placeholder {
  margin-right: 18px;
  margin-left: 18px;
}

body.app-active #view-chats .chat-layout,
body.app-active #view-chats .contact-list,
body.app-active .settings-list {
  gap: 0;
}

body.app-active #view-chats .contact-row,
body.app-active #view-chats .archived-conversations-entry,
body.app-active .business-conversation-list .contact-row {
  min-height: 70px;
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--separator);
  border-radius: 0;
  padding: 11px 18px;
  background: transparent;
}

body.app-active #view-chats .contact-row {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: pan-y;
}

body.app-active #view-chats .contact-row:not(.group-row) {
  min-height: 62px;
  border-bottom: 0;
  padding-top: 8px;
  padding-bottom: 8px;
}

body.app-active #view-chats .contact-row:active,
body.app-active #view-chats .contact-row:focus-visible,
body.app-active .business-conversation-list .contact-row:active,
body.app-active .business-conversation-list .contact-row:focus-visible {
  background: var(--surface-subtle);
}

body.app-active #view-chats .contact-row.group-row {
  min-height: 82px;
  margin: 7px 12px;
  border: 1px solid rgba(35, 139, 209, 0.34);
  border-radius: 16px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(35, 139, 209, 0.13), rgba(83, 219, 157, 0.07));
  box-shadow: inset 4px 0 0 rgba(35, 139, 209, 0.72), 0 5px 16px rgba(20, 74, 111, 0.08);
}

body.app-active #view-chats .contact-row.group-row:active,
body.app-active #view-chats .contact-row.group-row:focus-visible {
  background: rgba(35, 139, 209, 0.14);
}

body.app-active .settings-row,
body.app-active .settings-card {
  border: 0;
  border-bottom: 1px solid var(--separator);
  border-radius: 0;
  padding: 18px 2px;
  background: transparent;
}

body.app-active .settings-card select,
body.app-active select {
  border-color: var(--line);
  background: var(--panel);
  color: var(--text);
}

body.app-active .contact-avatar,
body.app-active .chat-header-avatar,
body.app-active .profile-avatar {
  background: rgba(35, 139, 209, 0.14);
  color: var(--accent-strong);
}

body.app-active #view-chats .group-avatar {
  width: 52px;
  height: 52px;
  border: 1px solid rgba(35, 139, 209, 0.4);
  border-radius: 16px;
  background: rgba(35, 139, 209, 0.2);
}

.group-conversation-label {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(35, 139, 209, 0.15);
  color: var(--accent-strong);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.5;
  text-transform: uppercase;
}

.group-photo-setting {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
}

.group-photo-button {
  display: grid;
  grid-template-columns: 50px auto;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 76px;
  min-width: 0;
  padding: 10px;
}

.group-photo-setting .group-avatar {
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  border-radius: 15px;
}

.group-photo-setting > .muted {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1;
  margin: 0;
}

.group-photo-setting #remove-group-photo {
  position: absolute;
  top: 4px;
  right: 4px;
  min-height: 30px;
  padding: 4px 7px;
  font-size: 0;
}

.group-photo-setting #remove-group-photo::before {
  content: "\00d7";
  font-size: 18px;
}

.group-name-form {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-subtle);
}

.group-name-form label,
.group-name-actions {
  display: grid;
  gap: 8px;
}

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

.group-name-form .muted {
  min-height: 0;
  margin: 0;
}

.group-avatar-icon {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

body.app-active .nav-item.active {
  border-color: transparent;
  background: var(--surface-subtle);
  color: var(--accent-strong);
}

body.app-active .chat-create-menu-button {
  --connection-glow: rgba(117, 186, 255, 0.22);
  background: var(--panel);
}

:root[data-theme="light"] body.app-active button:not(.danger):not(.decline) {
  color: var(--text);
}

.message-original {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--separator);
  color: var(--muted);
}

.message-original-label {
  color: var(--accent);
  font-size: 0.5em;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.message-original p,
.message-translation {
  margin: 0;
}

.message-original p {
  font-size: 0.65em;
  line-height: 1.35;
}

.action-sheet-delete {
  display: grid;
  gap: 10px;
}

.action-sheet-delete[hidden] {
  display: none;
}

.action-sheet-delete p {
  margin: 0 0 2px;
  color: var(--muted);
}

:root[data-theme="light"] body.app-active .hero,
:root[data-theme="light"] body.app-active .app-panel,
:root[data-theme="light"] body.app-active .app-view,
:root[data-theme="light"] body.app-active .bottom-nav,
:root[data-theme="light"] body.app-active .app-header {
  background: var(--panel);
  color: var(--text);
}

:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-normal .app-header,
:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-normal .chat-toolbar,
:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-normal .message-footer {
  border-color: var(--separator);
  background: #f5f9fd;
}

:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-normal .message-list-shell {
  background: #eaf3fa;
}

:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-normal .message.outgoing {
  border-color: #80bde8;
  background: #d9edfc;
  color: #102235;
}

:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-normal .message:not(.outgoing):not(.emoji-only) {
  border-color: #d2e1ec;
  background: #ffffff;
  color: #102235;
}

:root[data-theme="light"] body.app-active .message p a {
  color: var(--accent-strong);
}

:root[data-theme="light"] body.app-active .message-date-divider,
:root[data-theme="light"] body.app-active .message-system {
  border-color: #cfdee9;
  background: rgba(255, 255, 255, 0.92);
  color: #637789;
}

:root[data-theme="light"] body.app-active .message-time {
  background: rgba(239, 246, 252, 0.94);
  color: #40586d;
}

:root[data-theme="light"] body.app-active .message-input-row textarea,
:root[data-theme="light"] body.app-active input,
:root[data-theme="light"] body.app-active textarea {
  border-color: #b7d4e8;
  background: #ffffff;
  color: #102235;
}

:root[data-theme="light"] body.app-active .translate-chip,
:root[data-theme="light"] body.app-active .translate-chip.active {
  border-color: rgba(35, 139, 209, 0.28);
  background: rgba(35, 139, 209, 0.08);
  color: #0877bd;
}

:root[data-theme="light"] body.app-active .chat-details-setting .chat-translation-toggle {
  border-color: #8fc5e8;
  background: #eef7fd;
  color: #526b7e;
}

:root[data-theme="light"] body.app-active .header-call-button {
  border-color: #8fc5e8;
  background: #e7f3fb;
  color: #0877bd;
}

:root[data-theme="light"] body.app-active .app-panel.chat-open .chat-mode-control,
:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-normal .chat-mode-control,
:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-privacy .chat-mode-control {
  border-color: #aecfe5;
  background: #edf5fa;
}

:root[data-theme="light"] body.app-active .app-panel.chat-open .chat-mode-control button {
  border-color: transparent;
  background: transparent;
  color: #526b7e;
}

:root[data-theme="light"] body.app-active .app-panel.chat-open .chat-mode-control button.active,
:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-normal .chat-mode-control button.active {
  border-color: #70afe0;
  background: #d9edfc;
  color: #075f99;
}

:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-privacy .chat-mode-control button.active {
  border-color: #ad8bd2;
  background: #eee4f8;
  color: #59377a;
}

/* Privacy chats stay visibly different, but remain fully light and readable. */
:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-privacy .chat-mode-control {
  border-color: #c9b3dc;
  background: #f5effa;
}

:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-privacy .chat-mode-control button {
  color: #665673;
}

:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-privacy .app-header,
:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-privacy .chat-toolbar,
:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-privacy .message-footer {
  border-color: #d8c7e8;
  background: #faf7fd;
  color: #2d2138;
}

:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-privacy .message-list-shell {
  background: #f3edf8;
}

:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-privacy .message-list-shell::before {
  background: #cdb9df;
  opacity: 0.28;
}

:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-privacy .message.outgoing {
  border-color: #b795d2;
  background: #eadcf5;
  color: #2b1c36;
}

:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-privacy .message:not(.outgoing):not(.emoji-only) {
  border-color: #d9cbe5;
  background: #ffffff;
  color: #2b1c36;
}

:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-privacy .message-input-row textarea {
  border-color: #b795d2;
  background: #ffffff;
  color: #2b1c36;
  caret-color: #744b94;
}

:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-privacy .message-input-row textarea::placeholder {
  color: #796d83;
}

:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-privacy .send-button {
  border-color: #744b94;
  background: #a77cdb;
  color: #21132d;
}

:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-privacy .translate-chip.privacy,
:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-privacy .reply-composer-preview {
  border-color: #c4acd8;
  background: #f0e6f7;
  color: #59377a;
}

:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-privacy .message-reply-quote {
  border-left-color: #a77cdb;
  background: rgba(116, 75, 148, 0.09);
  color: #2b1c36;
}

:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-privacy .message-reply-quote strong {
  color: #744b94;
}

:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-privacy .message-reaction-chip {
  border-color: #d0bedf;
  background: #ffffff;
  color: #2b1c36;
}

:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-privacy .message-reaction-chip.mine {
  border-color: #a77cdb;
  background: #eadcf5;
}

:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-privacy .reply-composer-preview strong,
:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-privacy .privacy-composer-shield,
:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-privacy .message-swipe-reply {
  color: #744b94;
}

:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-privacy .header-call-button {
  border-color: #c5acd9;
  background: #f0e6f7;
  color: #744b94;
}

:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-privacy .message-date-divider,
:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-privacy .message-system,
:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-privacy .message-time {
  border-color: #d8c7e8;
  background: rgba(255, 255, 255, 0.94);
  color: #665673;
}

:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-privacy .unread-divider {
  border-color: #a77cdb;
  background: #eadcf5;
  color: #59377a;
}

:root[data-theme="light"] body.app-active .app-panel.chat-open.chat-theme-privacy .message.message-action-active {
  box-shadow: 0 0 0 3px rgba(116, 75, 148, 0.38);
}

:root[data-theme="light"] .action-sheet {
  border-color: #bfd6e6;
  background: #ffffff;
  color: #102235;
  box-shadow: 0 18px 50px rgba(29, 58, 80, 0.24);
}

:root[data-theme="light"] .action-sheet h3,
:root[data-theme="light"] .action-sheet label,
:root[data-theme="light"] .action-sheet .action-sheet-label {
  color: #102235;
}

:root[data-theme="light"] .action-sheet button:not(.danger-secondary) {
  border-color: #9fc8e3;
  background: #edf6fc;
  color: #123f5e;
}

:root[data-theme="light"] .action-sheet .danger-secondary {
  border-color: #e4aaa2;
  background: #fff0ee;
  color: #a83328;
}

:root[data-theme="light"] .message-action-preview {
  border-left-color: #238bd1;
  background: #eaf4fb;
  color: #18344a;
}

:root[data-theme="light"] .message-reaction-picker button {
  border-color: #c3d8e7;
  background: #f7fafc;
  color: #102235;
}

:root[data-theme="light"] .message-reaction-picker button.active {
  border-color: #238bd1;
  background: #d9edfc;
}

:root[data-theme="light"] .action-sheet input,
:root[data-theme="light"] .action-sheet textarea,
:root[data-theme="light"] .action-sheet select {
  border-color: #a9cbe2;
  background: #ffffff;
  color: #102235;
}

:root[data-theme="light"] body.app-active .danger-card > span,
:root[data-theme="light"] body.app-active .danger-card > strong,
:root[data-theme="light"] body.app-active .danger-card > p {
  color: #7b302a;
}

:root[data-theme="light"] body.app-active .danger-card button {
  border-color: #d56c61;
  background: #fff0ee;
  color: #9d2f26;
}

:root[data-theme="light"] body.app-active .danger-card .confirm-box {
  border-color: #e4aaa2;
  background: #fff7f5;
  color: #6b2924;
}

/* Complete light-theme coverage for secondary screens, dialogs and generated codes. */
:root[data-theme="light"] .invite-result,
:root[data-theme="light"] .blocked-contacts-panel,
:root[data-theme="light"] .blocked-contact-row,
:root[data-theme="light"] .blocked-contacts-view-hint,
:root[data-theme="light"] .group-create-panel,
:root[data-theme="light"] .contact-request-row,
:root[data-theme="light"] .recovery-code-panel,
:root[data-theme="light"] .security-log,
:root[data-theme="light"] .security-log-entry,
:root[data-theme="light"] .business-profile-form,
:root[data-theme="light"] .business-workspace-card,
:root[data-theme="light"] .business-sites-card,
:root[data-theme="light"] .business-link-card,
:root[data-theme="light"] .business-inbox-card,
:root[data-theme="light"] .business-feature-list article,
:root[data-theme="light"] .business-locked-panel,
:root[data-theme="light"] .admin-metric,
:root[data-theme="light"] .admin-media-report {
  border-color: var(--line);
  background: #ffffff;
  color: var(--text);
}

:root[data-theme="light"] .business-site-row {
  border-color: #c7d9e8;
  background: #f7fbfe;
}

:root[data-theme="light"] .invite-result code,
:root[data-theme="light"] .business-link-details code,
:root[data-theme="light"] #recovery-code-output,
:root[data-theme="light"] #recovery-first-words {
  border-color: #a9cbe2;
  background: #eef6fc;
  color: #0877bd;
}

:root[data-theme="light"] .contact-invite-copy-field {
  border-color: #a9cbe2;
  background: #eef6fc;
}

:root[data-theme="light"] .invite-result span,
:root[data-theme="light"] .security-log-entry time,
:root[data-theme="light"] .business-feature-list span,
:root[data-theme="light"] .business-locked-panel p,
:root[data-theme="light"] .business-phase-note {
  color: var(--muted);
}

:root[data-theme="light"] .divider::before,
:root[data-theme="light"] .divider::after {
  background: var(--separator);
}

:root[data-theme="light"] .chat-create-menu,
:root[data-theme="light"] .composer-menu,
:root[data-theme="light"] .group-panel-dialog {
  border-color: #a9cbe2;
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 16px 42px rgba(29, 58, 80, 0.2);
}

:root[data-theme="light"] .composer-icon-button {
  border-color: #8fc5e8;
  background: #edf6fc;
  color: #0877bd;
}

:root[data-theme="light"] .composer-menu button:hover,
:root[data-theme="light"] .composer-menu button:focus-visible {
  background: rgba(143, 197, 232, 0.16);
}

:root[data-theme="light"] .composer-menu-icon {
  border-color: #8fc5e8;
  background: #edf6fc;
  color: #0877bd;
}

:root[data-theme="light"] .call-backdrop {
  background: rgba(29, 43, 58, 0.46);
}

:root[data-theme="light"] .call-dialog {
  border-color: #a9cbe2;
  background: #ffffff;
  color: var(--text);
}

:root[data-theme="light"] .call-avatar {
  border-color: #70afe0;
  background: #d9edfc;
  color: #0877bd;
}

:root[data-theme="light"] .call-action.neutral {
  background: #e6eef5;
  color: #24445e;
}

:root[data-theme="light"] body.app-active .call-action.accept {
  background: #22b85a;
  color: #fff;
}

:root[data-theme="light"] body.app-active .call-action.decline {
  background: #e5484d;
  color: #fff;
}

:root[data-theme="light"] .live-translation-launch-card {
  border-color: #a9cbe2;
  background: linear-gradient(135deg, #ffffff, #edf7ff);
  color: var(--text);
}

:root[data-theme="light"] .live-translation-canvas {
  border-color: #9cc8e5;
  background: #ffffff;
  color: var(--text);
}

:root[data-theme="light"] .live-translation-language-link,
:root[data-theme="light"] .live-translation-workspace-icon {
  border-color: #9cc8e5;
  background: #edf7ff;
  color: #0877bd;
}

:root[data-theme="light"] .quick-translation-card {
  border-color: #a9cbe2;
  background: linear-gradient(135deg, #ffffff, #edf7ff);
  color: var(--text);
}

:root[data-theme="light"] .quick-translation-languages select {
  border-color: #a9cbe2;
  background: #ffffff;
  color: var(--text);
}

:root[data-theme="light"] #quick-translation-input {
  border-color: #9cc8e5;
  background: #ffffff;
  color: var(--text);
}

:root[data-theme="light"] .quick-translation-input-clear {
  background: #e8f1f7;
  color: #4b6477;
}

:root[data-theme="light"] .quick-translation-action-icon {
  border-color: #9cc8e5;
  background: #edf7ff;
  color: #0877bd;
}

:root[data-theme="light"] .quick-translation-mic .quick-translation-action-icon {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

:root[data-theme="light"] .translation-mode-tabs {
  border-color: #bfd2df;
  background: #edf4f8;
}

:root[data-theme="light"] .translation-mode-tabs button.active {
  border-color: #70afe0;
  background: #fff;
}

:root[data-theme="light"] #quick-translation-output {
  border-color: #9cc8e5;
  background: #f5fbff;
}

:root[data-theme="light"] .live-translation-launch-icon {
  border-color: #70afe0;
  background: #e5f3fc;
  color: #0877bd;
}

:root[data-theme="light"] .recovery-first-warning {
  border-color: #dfbd62;
  background: #fff8df;
  color: #674d08;
}

:root[data-theme="light"] .recovery-first-confirm {
  border-color: #a9cbe2;
  background: #f7fbfe;
  color: var(--text);
}

:root[data-theme="light"] .recovery-first-checkmark {
  border-color: #238bd1;
  background: #ffffff;
  color: #ffffff;
}

:root[data-theme="light"] .recovery-first-word {
  background: rgba(35, 139, 209, 0.07);
}

:root[data-theme="light"] .poll-option {
  border-color: #bfd6e6;
  background: #f7fafc;
  color: var(--text);
}

:root[data-theme="light"] .poll-option.selected {
  border-color: #70afe0;
  background: #d9edfc;
}

:root[data-theme="light"] .event-location-card,
:root[data-theme="light"] .event-time {
  border-color: #a9cbe2;
  background: #edf6fc;
  color: var(--text);
}

:root[data-theme="light"] .event-response-actions button.selected {
  border-color: #70afe0;
  background: #d9edfc;
  color: #075f99;
}

:root[data-theme="light"] .location-share-pin,
:root[data-theme="light"] .location-message-pin {
  border-color: #8fc5e8;
  background: #e5f3fc;
}

:root[data-theme="light"] .support-message-list,
:root[data-theme="light"] .admin-media-evidence {
  border-color: var(--line);
  background: #f3f7fa;
  color: var(--text);
}

:root[data-theme="light"] .support-message,
:root[data-theme="light"] .support-ai-intro,
:root[data-theme="light"] .support-thread-button {
  border-color: #c4d8e7;
  background: #ffffff;
  color: var(--text);
}

:root[data-theme="light"] .support-message.outgoing,
:root[data-theme="light"] .support-thread-button.active {
  border-color: #80bde8;
  background: #d9edfc;
  color: var(--text);
}

:root[data-theme="light"] .support-ai-message {
  border-color: #8ebfde;
  background: #edf6fc;
  color: var(--text);
}

:root[data-theme="light"] .business-profile-form input,
:root[data-theme="light"] .business-profile-form textarea,
:root[data-theme="light"] .business-profile-form select {
  border-color: #a9cbe2;
  background: #ffffff;
  color: var(--text);
}

:root[data-theme="light"] .business-conversation-row {
  border-color: #a9cbe2;
  background: #edf6fc;
  color: var(--text);
}

:root[data-theme="light"] .business-widget-conversation-row,
:root[data-theme="light"] .business-widget-messages,
:root[data-theme="light"] .business-widget-message {
  border-color: #c7d9e8;
  background: #f7fbfe;
  color: var(--text);
}

:root[data-theme="light"] .business-widget-conversation-row.unread,
:root[data-theme="light"] .business-widget-message.outgoing {
  border-color: #80bde8;
  background: #e5f3fc;
}

:root[data-theme="light"] .business-conversation-count,
:root[data-theme="light"] .business-contact-label {
  border-color: #238bd1;
  color: #0877bd;
}

:root[data-theme="light"] .jump-to-latest {
  border-color: #8fc5e8;
  background: rgba(255, 255, 255, 0.94);
  color: #0877bd;
  box-shadow: 0 3px 12px rgba(29, 58, 80, 0.18);
}

@media (max-width: 700px) {
  body.app-active .shell {
    padding: 0;
  }

  body.app-active .app-panel {
    min-height: 0;
  }

  body.app-active #view-chats .contact-row,
  body.app-active #view-chats .archived-conversations-entry {
    padding-right: 16px;
    padding-left: 16px;
  }
}
