:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #e7edf1;
  color: #111b21;
  --app-bg: #e7edf1;
  --chat-bg: #efeae2;
  --surface: #ffffff;
  --surface-soft: #f4f6f7;
  --surface-press: #eef2f4;
  --line: #d8dee3;
  --line-strong: #c6d0d7;
  --text: #111b21;
  --muted: #667781;
  --primary: #167d73;
  --primary-dark: #0f655d;
  --accent: #2f6df6;
  --sent: #d9fdd3;
  --received: #ffffff;
  --danger: #c2413d;
  --shadow: 0 18px 48px rgb(17 27 33 / 12%);
  --chat-sidebar-width: clamp(310px, 28vw, 380px);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--app-bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  background: var(--primary);
  color: #ffffff;
  cursor: pointer;
  font-weight: 750;
}

button:hover {
  background: var(--primary-dark);
}

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

.secondary-button,
.icon-button {
  border: 1px solid transparent;
  background: transparent;
  color: #334047;
}

.secondary-button {
  border-color: var(--line);
  background: #ffffff;
}

.secondary-button:hover,
.icon-button:hover {
  background: var(--surface-press);
}

.icon-button {
  width: 42px;
  min-width: 42px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.text-button {
  min-height: auto;
  justify-self: start;
  padding: 2px 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
}

.text-button:hover {
  background: transparent;
  color: var(--primary);
}

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

.danger-button:hover {
  background: #9f312e;
}

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

.app-shell {
  min-height: 100vh;
  padding: 18px;
}

.auth-panel {
  width: min(1180px, 100%);
  min-height: calc(100vh - 36px);
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 14px;
}

body.signed-in .app-shell {
  padding: 0;
}

body.signed-in .auth-panel {
  width: 100%;
  min-height: 100vh;
  display: block;
}

body.signed-in .app-topbar {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.app-topbar,
.panel,
.toast {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.app-topbar {
  min-height: 70px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-lockup,
.topbar-actions,
.preview-row,
.button-row,
.thread-title-row,
.thread-actions,
.composer,
.mobile-app-header,
.account-chip,
.header-actions {
  display: flex;
  align-items: center;
}

.brand-lockup,
.account-chip {
  gap: 12px;
}

.topbar-actions,
.header-actions {
  justify-content: flex-end;
  gap: 4px;
}

.brand-mark,
.account-avatar,
.thread-avatar,
.preview-avatar,
.conversation-avatar {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 800;
}

.brand-mark,
.account-avatar {
  width: 44px;
  height: 44px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}

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

h1 {
  margin-bottom: 1px;
  font-size: 1.35rem;
  line-height: 1.1;
}

h2 {
  margin-bottom: 10px;
  font-size: 1.08rem;
}

h3 {
  margin-bottom: 8px;
  font-size: 0.96rem;
}

p {
  color: var(--muted);
  line-height: 1.45;
}

.brand-subtitle {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.status-pill {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  padding: 6px 10px;
  color: #3f5060;
  font-size: 0.85rem;
  white-space: nowrap;
}

.toast {
  position: fixed;
  top: 14px;
  left: 50%;
  z-index: 50;
  transform: translateX(-50%);
  max-width: min(680px, calc(100vw - 24px));
  padding: 10px 14px;
  color: #223244;
  font-weight: 750;
}

.toast:empty,
.toast[hidden] {
  display: none;
}

.auth-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(300px, 390px);
  gap: 14px;
  align-items: stretch;
}

body.signed-in .auth-grid {
  display: none;
}

.welcome-panel {
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 42px;
  background: #ffffff;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 28px;
  align-items: center;
}

.welcome-copy h2 {
  max-width: 520px;
  margin-bottom: 12px;
  font-size: 4.2rem;
  line-height: 1;
}

.welcome-copy p {
  max-width: 430px;
  margin-bottom: 0;
  font-size: 1.05rem;
}

.welcome-phone {
  width: 260px;
  min-height: 470px;
  border: 10px solid #1f2933;
  border-radius: 34px;
  padding: 12px;
  background: var(--chat-bg);
  box-shadow: 0 22px 54px rgb(17 27 33 / 18%);
  display: grid;
  grid-template-rows: 28px 1fr;
}

.phone-top {
  justify-self: center;
  width: 82px;
  height: 5px;
  border-radius: 999px;
  background: #1f2933;
}

.phone-thread {
  display: grid;
  align-content: end;
  gap: 10px;
}

.preview-row {
  gap: 8px;
}

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

.preview-avatar {
  width: 34px;
  height: 34px;
  color: #ffffff;
  background: #536477;
}

.preview-bubble {
  max-width: 185px;
  border-radius: 18px;
  padding: 9px 11px;
  font-size: 0.95rem;
  box-shadow: 0 6px 14px rgb(17 27 33 / 8%);
}

.preview-bubble.incoming {
  background: #ffffff;
}

.preview-bubble.outgoing {
  background: var(--sent);
}

.preview-composer {
  height: 40px;
  border-radius: 999px;
  background: #ffffff;
}

.panel {
  padding: 18px;
  display: grid;
  gap: 12px;
}

.auth-card {
  align-content: center;
  gap: 20px;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.new-account {
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

label {
  display: grid;
  gap: 6px;
  color: #344557;
  font-size: 0.9rem;
  font-weight: 650;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #c8d2dc;
  border-radius: 14px;
  padding: 10px 13px;
  background: #ffffff;
  color: var(--text);
}

input:focus,
select:focus,
button:focus-visible,
summary:focus-visible {
  outline: 3px solid rgb(22 125 115 / 22%);
  outline-offset: 2px;
}

.messenger-panel {
  height: 100vh;
  height: 100dvh;
  min-height: 560px;
  background: var(--surface);
  display: grid;
  grid-template-columns: 1fr;
}

body.thread-open .messenger-panel {
  grid-template-columns: 1fr;
}

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

.mobile-app-header {
  min-height: 70px;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.mobile-app-header h2,
.thread-header h2,
.panel-heading h2 {
  margin-bottom: 2px;
}

.account-name,
.thread-header p,
.panel-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.search-field {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.search-field input {
  border: 0;
  background: var(--surface-soft);
  padding-left: 16px;
}

.chat-filters {
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
}

.filter-chip {
  min-height: 34px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: #334047;
  font-size: 0.9rem;
}

.filter-chip[aria-pressed="true"] {
  border-color: #b9d8d3;
  background: #e7f5f2;
  color: var(--primary-dark);
}

.conversation-list,
.message-list,
.device-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.conversation-list {
  min-height: 190px;
  overflow: auto;
}

.conversation-list:empty::before {
  content: "Search for someone to start a chat";
  display: block;
  padding: 22px 16px;
  color: var(--muted);
}

.conversation-list button {
  width: 100%;
  min-height: 74px;
  border: 0;
  border-bottom: 1px solid #edf1f3;
  border-radius: 0;
  padding: 12px 14px;
  background: transparent;
  color: var(--text);
  text-align: left;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.conversation-list button:hover,
.conversation-list button[aria-current="true"] {
  background: #edf7f5;
}

.conversation-avatar {
  width: 48px;
  height: 48px;
  color: #ffffff;
  background: #536477;
}

.conversation-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.conversation-title-row,
.conversation-preview-row {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.conversation-list strong,
.conversation-list span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-time {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
}

.conversation-meta {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.unread-badge {
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  padding: 0 6px;
  background: var(--primary);
  color: #ffffff;
  display: inline-grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 800;
}

.thread-pane {
  position: relative;
  min-width: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background:
    linear-gradient(45deg, rgb(17 27 33 / 3%) 25%, transparent 25%),
    linear-gradient(-45deg, rgb(17 27 33 / 3%) 25%, transparent 25%),
    var(--chat-bg);
  background-size: 34px 34px;
  display: grid;
  grid-template-rows: auto auto auto auto auto minmax(0, 1fr) auto;
}

body:not(.thread-open) .thread-pane {
  display: none;
}

body.thread-open .thread-pane {
  grid-column: 1;
}

.thread-header {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.thread-title-row,
.thread-actions {
  gap: 8px;
}

.thread-title-row {
  min-width: 0;
}

.thread-heading {
  min-width: 0;
}

.thread-heading h2,
.thread-heading p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-actions {
  flex: 0 0 auto;
}

.thread-avatar {
  width: 44px;
  height: 44px;
  color: #ffffff;
  background: var(--primary);
}

.back-button {
  display: none;
}

body.thread-open .back-button {
  display: inline-grid;
}

.call-banner {
  margin: 12px 12px 0;
  border: 1px solid #b9d8d3;
  border-radius: 18px;
  padding: 12px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 8px 22px rgb(17 27 33 / 8%);
}

.call-banner p {
  margin-bottom: 0;
}

.call-banner-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.call-room {
  margin: 8px 12px 0;
  border: 1px solid #b9d8d3;
  border-radius: 18px;
  padding: 12px;
  background: #ffffff;
  display: grid;
  gap: 12px;
  box-shadow: 0 8px 22px rgb(17 27 33 / 8%);
}

.call-room .button-row {
  justify-content: flex-end;
}

.group-panel {
  margin: 8px 12px 0;
  border: 1px solid #b9d8d3;
  border-radius: 18px;
  padding: 12px;
  background: #ffffff;
  display: grid;
  gap: 12px;
  box-shadow: 0 8px 22px rgb(17 27 33 / 8%);
}

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

.message-list {
  padding: 18px 18px 86px;
  overflow: auto;
  align-content: end;
  display: grid;
  gap: 8px;
}

.message-list:empty::before {
  content: "Select a chat or search for someone to start messaging";
  justify-self: center;
  align-self: center;
  color: #4f5f67;
  background: rgb(255 255 255 / 72%);
  border-radius: 999px;
  padding: 8px 14px;
}

.message-list li {
  position: relative;
  width: fit-content;
  max-width: min(620px, 74%);
  border-radius: 16px;
  padding: 8px 10px 6px;
  background: var(--received);
  color: var(--text);
  overflow-wrap: anywhere;
  box-shadow: 0 2px 8px rgb(17 27 33 / 8%);
}

.message-list li[data-direction="sent"],
.message-list li[data-direction="synced"] {
  justify-self: end;
  background: var(--sent);
}

.message-list li[data-status="failed"] {
  border: 1px solid #e06b6b;
  background: #fff5f5;
}

.message-list li[data-kind="system"] {
  justify-self: center;
  max-width: min(560px, 88%);
  border: 1px solid #d7c46b;
  border-radius: 10px;
  padding: 7px 12px;
  background: #fff8d8;
  color: #4d4312;
  box-shadow: none;
}

.message-list li[data-kind="system"] .message-body {
  padding-right: 0;
  font-size: 0.86rem;
  text-align: center;
}

.message-list li[data-kind="system"] .message-time {
  text-align: center;
  color: #7a6b24;
}

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

.message-body {
  display: block;
  padding-right: 40px;
  line-height: 1.35;
}

.message-attachments,
.message-attachment {
  display: grid;
  gap: 6px;
}

.message-attachments {
  margin-top: 8px;
}

.message-attachment img,
.message-attachment video {
  max-width: min(360px, 100%);
  max-height: 280px;
  border-radius: 10px;
  object-fit: contain;
  background: rgb(255 255 255 / 58%);
}

.message-attachment audio {
  width: min(360px, 100%);
}

.message-attachment a {
  color: #0d5a78;
  font-weight: 750;
}

.message-time {
  display: block;
  margin-top: 2px;
  color: #60717a;
  font-size: 0.72rem;
  text-align: right;
}

.message-list li button {
  min-height: 32px;
  margin-top: 8px;
  padding: 6px 10px;
}

.composer {
  position: fixed;
  right: 0;
  bottom: 0;
  bottom: env(safe-area-inset-bottom, 0);
  left: 0;
  z-index: 4;
  gap: 8px;
  padding: 10px;
  padding-bottom: max(10px, env(safe-area-inset-bottom, 0));
  background: var(--surface);
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

body.thread-open .composer {
  left: 0;
}

body.thread-open .chat-sidebar {
  display: none;
}

.file-button {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #ffffff;
  color: #334047;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  font-weight: 500;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

.message-field {
  flex: 1 1 auto;
}

.message-field input {
  border: 0;
  border-radius: 999px;
}

.attachment-preview {
  order: -1;
  flex-basis: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 34px;
  border: 1px solid #c7d8d4;
  border-radius: 999px;
  padding: 6px 8px 6px 12px;
  background: #eef8f6;
  color: #183d3a;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 700;
}

.attachment-preview[hidden] {
  display: none;
}

.attachment-preview span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-preview button {
  flex: 0 0 auto;
  min-height: 24px;
  width: 24px;
  padding: 0;
  border-radius: 50%;
  background: #d5ece8;
  color: #183d3a;
}

.compose-fab {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 3;
  width: 56px;
  min-width: 56px;
  height: 56px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  box-shadow: 0 14px 30px rgb(17 27 33 / 22%);
}

.bottom-nav {
  display: none;
}

.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
}

.compose-sheet {
  align-self: stretch;
  min-width: 0;
  height: 100vh;
  overflow: auto;
  border-left: 1px solid var(--line);
  background: #ffffff;
  box-shadow: -18px 0 50px rgb(10 18 26 / 18%);
  display: grid;
  grid-template-rows: auto auto 1fr;
}

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

.sheet-header h2,
.sheet-header p {
  margin-bottom: 0;
}

.segmented-control {
  margin: 14px 16px 0;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface-soft);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.segmented-control button {
  min-height: 36px;
  background: transparent;
  color: #334047;
}

.segmented-control button[aria-pressed="true"] {
  background: #ffffff;
  color: var(--primary-dark);
  box-shadow: 0 1px 4px rgb(17 27 33 / 10%);
}

.sheet-form {
  align-content: start;
  padding: 16px;
  display: grid;
  gap: 12px;
}

.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 460px);
}

.settings-scrim {
  min-height: 100%;
  border-radius: 0;
  background: rgb(10 18 26 / 42%);
}

.settings-scrim:hover {
  background: rgb(10 18 26 / 42%);
}

.settings-drawer {
  min-width: 0;
  height: 100vh;
  overflow: auto;
  border-left: 1px solid var(--line);
  background: #ffffff;
  box-shadow: -18px 0 50px rgb(10 18 26 / 18%);
  display: grid;
  grid-template-rows: auto 1fr;
}

.settings-header {
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-header h2,
.settings-header p {
  margin-bottom: 0;
}

.tools-grid {
  display: grid;
}

.settings-section {
  border-bottom: 1px solid var(--line);
  padding: 16px;
  display: grid;
  gap: 12px;
}

.panel-heading {
  display: grid;
  gap: 2px;
}

.technical-id {
  display: none;
}

.button-row {
  gap: 8px;
  flex-wrap: wrap;
}

.rename-device-field {
  flex: 1 1 180px;
  max-width: 320px;
}

.rename-device-field input {
  min-height: 42px;
}

.soft-box {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: var(--surface-soft);
  display: grid;
  gap: 8px;
}

.soft-box h3 {
  margin-bottom: 0;
}

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

.device-list:empty {
  display: none;
}

.device-list li {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: var(--surface-soft);
  display: grid;
  gap: 8px;
}

.device-list strong,
.device-list span {
  overflow-wrap: anywhere;
}

.advanced-drawer,
.activity-panel {
  overflow: hidden;
}

.advanced-drawer,
.activity-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
}

summary {
  cursor: pointer;
  padding: 10px 12px;
  color: #263646;
  font-weight: 750;
}

.advanced-drawer > :not(summary) {
  margin: 0 12px 12px;
}

.advanced-drawer .button-row {
  margin-top: 10px;
}

.call-stage {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.call-stage h3 {
  margin: 0 0 8px;
}

.media-grid {
  min-height: 126px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #101820;
  display: grid;
  gap: 8px;
  padding: 8px;
}

.media-grid video,
.media-grid audio {
  width: 100%;
  max-height: 240px;
  border-radius: 12px;
  background: #111827;
}

.activity-panel[open] summary {
  border-bottom: 1px solid var(--line);
}

.log {
  min-height: 96px;
  max-height: 220px;
  margin: 0;
  overflow: auto;
  background: #101820;
  color: #e6edf3;
  padding: 12px;
  white-space: pre-wrap;
}

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

  .welcome-panel {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .welcome-phone {
    justify-self: center;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 0;
  }

  .auth-panel {
    min-height: 100vh;
    min-height: 100dvh;
    gap: 0;
  }

  .app-topbar,
  .panel,
  .welcome-panel,
  .toast {
    border-radius: 0;
  }

  .app-topbar {
    box-shadow: none;
  }

  .brand-subtitle {
    display: none;
  }

  .welcome-panel {
    display: none;
  }

  .auth-card {
    min-height: calc(100vh - 70px);
    min-height: calc(100dvh - 70px);
    align-content: center;
    box-shadow: none;
  }

  .messenger-panel {
    min-height: 100vh;
    min-height: 100dvh;
    grid-template-columns: 1fr;
    overflow: hidden;
  }

  .chat-sidebar,
  .thread-pane {
    grid-column: 1;
    grid-row: 1;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .chat-sidebar {
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  }

  .thread-pane {
    transform: translateX(100%);
    transition: transform 160ms ease;
    z-index: 2;
  }

  body.thread-open .thread-pane {
    transform: translateX(0);
  }

  body.thread-open .composer {
    left: 0;
  }

  .chat-sidebar {
    border-right: 0;
  }

  .back-button {
    display: inline-grid;
  }

  .thread-header {
    padding-left: 8px;
  }

  .thread-actions {
    gap: 2px;
  }

  .thread-actions .thread-menu-button {
    display: none;
  }

  .message-list {
    padding: 14px 10px calc(82px + env(safe-area-inset-bottom, 0));
  }

  .message-list li {
    max-width: 86%;
  }

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

  .attachment-preview {
    max-width: 100%;
  }

  .composer button {
    padding-inline: 12px;
  }

  .settings-overlay {
    grid-template-columns: 1fr;
  }

  .sheet-overlay {
    grid-template-columns: 1fr;
  }

  .settings-scrim {
    display: none;
  }

  .settings-drawer,
  .compose-sheet {
    width: 100%;
    border-left: 0;
  }

  .bottom-nav {
    min-height: 64px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: #ffffff;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }

  .nav-button {
    min-height: 50px;
    border-radius: 14px;
    padding: 5px;
    background: transparent;
    color: var(--muted);
    display: grid;
    place-items: center;
    gap: 1px;
    font-size: 0.76rem;
  }

  .nav-button span:first-child {
    font-size: 1.08rem;
  }

  .nav-button[aria-current="page"] {
    background: #e7f5f2;
    color: var(--primary-dark);
  }

  .compose-fab {
    bottom: calc(78px + env(safe-area-inset-bottom));
  }

  .call-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .call-banner-actions {
    justify-content: flex-end;
  }

  .call-stage {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .thread-actions .icon-button {
    width: 38px;
    min-width: 38px;
    font-size: 0.78rem;
  }

  .thread-avatar,
  .account-avatar {
    width: 40px;
    height: 40px;
  }
}
