:root {
  color-scheme: light dark;
  --bg: #111827;
  --panel: #1f2937;
  --panel-strong: #263244;
  --surface: #f6f8fb;
  --surface-muted: #e8edf4;
  --line: #4b5563;
  --text: #f9fafb;
  --muted: #b6c2d1;
  --accent: #4f8cff;
  --accent-strong: #2563eb;
  --focus-ring: #4f8cff;
  --focus-shadow: rgba(79, 140, 255, .26);
  --good: #20c970;
  --warn: #f0b429;
  --danger: #ef4444;
  --bubble-self: #144f3a;
  --bubble-peer: #273242;
  --selection-bg: #213858;
  --selection-border: #6aa2ff;
  --selection-text: #ffffff;
  --selection-muted: #b6c2d1;
  --remote-draft-text: #dbeafe;
  --avatar-bg: #2563eb;
  --chat-background-image: none;
  --chat-background-overlay: rgba(5, 12, 24, .55);
  --radius: 8px;
  --call-safe-area-top: env(safe-area-inset-top, 0px);
  --call-safe-area-right: env(safe-area-inset-right, 0px);
  --call-safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --call-safe-area-left: env(safe-area-inset-left, 0px);
  font-family: "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

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

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

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  left: 14px;
  top: 14px;
  z-index: 1000;
  border: 2px solid var(--focus-ring);
  border-radius: 8px;
  background: #ffffff;
  color: #071526;
  padding: 10px 14px;
  font-weight: 700;
  transform: translateY(-140%);
  transition: transform .12s ease;
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
}

button {
  min-height: 34px;
  border: 1px solid #6aa2ff;
  border-radius: 6px;
  background: #16243a;
  color: var(--text);
  padding: 6px 12px;
  cursor: pointer;
}

button:hover:not(:disabled):not(.social-login-button):not(.google-sdk-login-overlay),
button.selected:not(.social-login-button):not(.google-sdk-login-overlay) {
  background: var(--accent-strong);
  color: #fff;
}

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

:where(button, button *, summary, summary *, .conversation-list, .conversation-list *, .topbar, .topbar *) {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

:where(input, textarea, [contenteditable="true"]) {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

:where(button, input, select, textarea, summary, a, [role="button"], [role="menuitem"], .conversation-item, .message-body, .attachment-card, .location-card):focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--focus-shadow);
}

.chat-header,
.message,
.remote-draft,
.composer,
.tab-panel,
.call-panel,
.attachment-card,
.location-card {
  scroll-margin: 76px;
}

.theme-button {
  min-width: 112px;
  font-weight: 700;
}

.top-menu {
  position: relative;
}

.top-menu summary {
  min-height: 34px;
  border: 1px solid #6aa2ff;
  border-radius: 6px;
  background: #16243a;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 6px 12px;
  user-select: none;
}

.top-icon-button {
  width: 38px;
  min-width: 38px;
  height: 34px;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}

.contrast-symbol {
  position: relative;
  display: block;
  width: 22px;
  height: 22px;
  border: 2px solid currentColor;
  border-radius: 50%;
  overflow: hidden;
  background: #ffffff;
}

.contrast-symbol span {
  position: absolute;
  inset: 0 0 0 50%;
  background: currentColor;
}

.top-actions .top-icon-button {
  flex: 0 0 38px;
}

.top-actions .top-icon-button:hover:not(:disabled) .material-icon,
.top-actions .top-icon-button:focus-visible .material-icon,
.top-actions .top-icon-button.selected .material-icon,
.top-actions .top-icon-button:hover:not(:disabled) .material-icon-svg,
.top-actions .top-icon-button:focus-visible .material-icon-svg,
.top-actions .top-icon-button.selected .material-icon-svg {
  color: #ffffff;
  fill: #ffffff;
}

.top-menu[open] summary .contrast-symbol,
.top-menu summary:hover .contrast-symbol,
.top-menu summary:focus-visible .contrast-symbol {
  border-color: #ffffff;
  background: transparent;
  color: #ffffff;
}

.top-menu[open] summary .contrast-symbol span,
.top-menu summary:hover .contrast-symbol span,
.top-menu summary:focus-visible .contrast-symbol span {
  background: #ffffff;
}

.logout-icon-button {
  margin-left: 2px;
  margin-right: 2px;
  border-color: #fecaca !important;
  background: #fff1f2 !important;
  color: #b91c1c !important;
}

.logout-icon-button:hover:not(:disabled),
.logout-icon-button:focus-visible {
  border-color: #ef4444 !important;
  background: #ef4444 !important;
  color: #ffffff !important;
}

.logout-icon-button:hover:not(:disabled) .material-icon,
.logout-icon-button:focus-visible .material-icon,
.logout-icon-button:hover:not(:disabled) .material-icon-svg,
.logout-icon-button:focus-visible .material-icon-svg {
  color: #ffffff !important;
  fill: #ffffff !important;
}

.logout-icon-button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.top-menu summary::-webkit-details-marker {
  display: none;
}

.top-menu[open] summary,
.top-menu summary:hover {
  background: var(--accent-strong);
  color: #ffffff;
}

.top-menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  min-width: 170px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .22);
  padding: 8px;
}

.top-menu-panel button {
  width: 100%;
  text-align: left;
}

.top-menu-field {
  display: grid;
  gap: 5px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.top-menu-field select {
  min-width: 210px;
}

.context-menu {
  position: fixed;
  z-index: 1200;
  display: grid;
  gap: 4px;
  min-width: 170px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: 0 16px 36px rgba(0, 0, 0, .32);
  padding: 6px;
}

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

.context-menu button {
  width: 100%;
  border-color: transparent;
  text-align: left;
}

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

.message-context-menu {
  min-width: 180px;
}

.group-member-context-menu {
  min-width: 210px;
}

.context-menu .danger-action:not(:disabled) {
  color: #fecaca;
}

.context-menu .danger-action:not(:disabled):hover {
  background: #b91c1c;
  color: #ffffff;
}

body.modal-open {
  overflow: hidden;
}

body.account-booting .app-shell {
  visibility: hidden;
}

body.account-booting .modal-shell {
  display: none !important;
}

body.account-gate .app-shell {
  visibility: hidden;
}

body.account-gate .modal-shell {
  background: var(--bg);
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  background: rgba(2, 6, 23, .58);
  padding: 16px;
}

.modal-shell[hidden] {
  display: none;
}

.modal-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  border: 1px solid #6aa2ff;
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .42);
  overflow: hidden;
}

.modal-header,
.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--panel-strong);
}

.modal-header {
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
}

.modal-header span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.modal-body {
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.modal-section {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.modal-section h3 {
  margin: 0;
  color: var(--accent);
  font-size: 15px;
}

.account-settings-menu {
  display: none;
  gap: 6px;
  z-index: 2;
  align-self: stretch;
  min-height: 0;
  max-height: none;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: var(--panel-strong);
  padding: 12px;
}

.account-settings-menu button,
.account-settings-menu > a {
  justify-content: flex-start;
  min-height: 40px;
  width: 100%;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-weight: 600;
  text-align: left;
  padding: 8px 10px;
}

.account-settings-menu > a {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.account-settings-menu button:hover,
.account-settings-menu button:focus-visible,
.account-settings-menu > a:hover,
.account-settings-menu > a:focus-visible {
  background: rgba(37, 99, 235, .08);
  color: var(--accent);
}

.account-settings-menu button.selected {
  border-left-color: var(--accent);
  background: transparent;
  color: var(--accent);
}

.account-menu-dialog .account-settings-menu {
  display: grid;
}

.account-settings-layout {
  display: contents;
}

.account-menu-dialog .account-dialog-card {
  width: min(980px, calc(100vw - 32px));
  height: min(760px, calc(100vh - 32px));
}

.account-menu-dialog .account-dialog-body {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  background: var(--surface-muted);
}

.account-menu-dialog .dialog-status {
  grid-row: 1;
  margin: 16px 16px 0;
  min-height: 34px;
  max-height: 52px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.account-menu-dialog .account-settings-layout {
  display: grid;
  grid-row: 2;
  grid-template-columns: minmax(180px, 230px) minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.account-menu-dialog .account-settings-menu {
  grid-column: 1;
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100%;
}

.account-menu-dialog .modal-section[data-settings-panel] {
  display: none;
}

.account-menu-dialog .modal-section[data-settings-panel].active-settings-panel {
  display: block;
  grid-column: 2;
  margin-bottom: 0;
  min-height: 0;
  overflow: auto;
  border-left: 1px solid var(--line);
  background: var(--panel);
  padding: 18px 20px 22px;
}

.account-menu-dialog .account-advanced {
  grid-column: 2;
  margin: 0;
  overflow: auto;
  border-left: 1px solid var(--line);
  background: var(--panel);
  padding: 18px 20px 22px;
}

.account-menu-dialog .modal-section[data-settings-panel].active-settings-panel > * + *,
.account-menu-dialog .account-advanced > * + * {
  margin-top: 10px;
}

.account-menu-dialog .modal-section[data-settings-panel] h3 {
  color: var(--text);
  font-size: 20px;
  line-height: 1.2;
  margin-bottom: 8px;
}

.account-menu-dialog .modal-section[data-settings-panel] > .account-dialog-grid,
.account-menu-dialog .modal-section[data-settings-panel] > .avatar-editor,
.account-menu-dialog .modal-section[data-settings-panel] > .settings-panel,
.account-menu-dialog .modal-section[data-settings-panel] > .security-password-grid,
.account-menu-dialog .modal-section[data-settings-panel] > .identity-link-panel,
.account-menu-dialog .modal-section[data-settings-panel] > .two-factor-qr-panel,
.account-menu-dialog .modal-section[data-settings-panel] > .security-code-grid,
.account-menu-dialog .modal-section[data-settings-panel] > .media-status,
.account-menu-dialog .modal-section[data-settings-panel] > .button-row,
.account-menu-dialog .modal-section[data-settings-panel] > .server-settings-lock-note {
  max-width: 680px;
}

.account-advanced {
  margin-top: 2px;
}

.account-advanced summary {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  list-style-position: inside;
  padding: 8px 10px;
}

.account-advanced[open] summary {
  margin-bottom: 12px;
}

.server-settings-lock-note {
  margin: 0;
  border: 1px solid rgba(240, 180, 41, .45);
  border-radius: 6px;
  background: rgba(240, 180, 41, .12);
  color: var(--warn);
  padding: 8px 10px;
  font-size: 13px;
}

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

.account-dialog-grid label {
  display: grid;
  gap: 4px;
  /* A taller neighbour (e.g. SIP From with its password row) must not stretch the input. */
  align-content: start;
  color: var(--muted);
  font-size: 13px;
}

/* A confirmed (password-proven) address: a green check. */
.verified-check {
  display: inline-flex;
  align-items: center;
  color: #16a34a;
}

.verified-check[hidden] {
  display: none;
}

.sip-from-select {
  display: inline-flex;
  flex: 1;
  min-width: 0;
  align-items: center;
  gap: 6px;
}

.sip-from-select select {
  flex: 1;
  min-width: 0;
}

/* Interpreter relay (KPN Teletolk): own icon and colour, because it behaves differently from ordinary SIP. */
.avatar.avatar-relay {
  background: #0f766e;
  color: #ffffff;
}

.relay-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.relay-chip-icon {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #0f766e;
  color: #ffffff;
}

.relay-chip-lock {
  display: inline-flex;
  color: var(--danger);
}

.relay-chip-lock[hidden] {
  display: none;
}

.relay-unlock {
  font-weight: 600;
}

/* Profile → SIP From: type the address, "Checken", and only then the password row. */
.account-dialog-grid .profile-sip-from {
  display: grid;
  gap: 4px;
  align-content: start;
  color: var(--muted);
  font-size: 13px;
}

.profile-sip-row {
  display: flex;
  gap: 6px;
}

.profile-sip-row input,
.profile-sip-row select {
  flex: 1;
  min-width: 0;
}

/* "myMMX-adres toevoegen": address → Controleren → password → Bevestigen. */
.sip-add-dialog {
  display: none;
}

.sip-add-dialog[open] {
  display: grid;
  gap: 12px;
}

.sip-add-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sip-add-dialog h2 {
  margin: 0;
}

.sip-add-dialog .profile-sip-from {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}

.sip-add-status,
.sip-add-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.sip-add-status:empty {
  display: none;
}

/* Error (e.g. wrong password): normal text colour for contrast, signalled by a red bar, tint and warning sign. */
.sip-add-status.is-error {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 8px 10px;
  border-left: 4px solid var(--danger);
  border-radius: 6px;
  background: rgba(239, 68, 68, .12);
  color: var(--text);
  font-weight: 600;
}

.sip-add-status.is-error::before {
  content: "\26A0";
  color: var(--danger);
}

.sip-add-dialog input[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px var(--danger);
}

.profile-sip-row button {
  flex: none;
}

.account-dialog-grid .modal-toggle {
  grid-column: 1 / -1;
  display: inline-flex;
  justify-content: flex-start;
}

.account-security-section {
  gap: 12px;
}

.security-password-grid {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  padding: 12px;
}

.password-fields-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.password-fields-row label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}

.password-rules-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  padding: 7px 10px;
  font-size: 12px;
  line-height: 1.25;
}

.password-rule {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.password-rule.valid {
  color: #16a34a;
  font-weight: 700;
}

.password-rule.invalid {
  color: #991b1b;
}

.password-rule-marker {
  display: inline-grid;
  place-items: center;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.password-rule.valid .password-rule-marker {
  background: #16a34a;
  color: #ffffff;
}

.password-rule.invalid .password-rule-marker {
  background: #fee2e2;
  color: #991b1b;
}

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

.password-actions-row .modal-toggle {
  display: inline-flex;
  width: auto;
  min-width: 0;
}

.password-actions-row button {
  min-width: 180px;
}

.login-two-factor-section {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  padding: 12px;
}

.login-two-factor-section[hidden] {
  display: none;
}

.identity-link-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  padding: 12px;
}

.identity-link-panel > div:first-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.identity-link-panel .button-row {
  flex: 0 0 auto;
}

.two-factor-qr-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  padding: 12px;
}

.two-factor-qr-code {
  display: grid;
  place-items: center;
  width: 172px;
  height: 172px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.two-factor-qr-code svg {
  display: block;
  width: 148px;
  height: 148px;
}

.two-factor-secret {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
}

.two-factor-secret code {
  user-select: all;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  padding: 8px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
}

.contact-profile-card {
  width: min(520px, calc(100vw - 32px));
}

.group-management-card {
  width: min(640px, calc(100vw - 32px));
}

.group-management-body {
  display: grid;
  gap: 14px;
}

.group-management-section {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  padding: 12px;
}

.group-management-section h3 {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.group-management-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
}

.group-management-tabs button {
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  padding: 8px 10px;
  font-weight: 700;
}

.group-management-tabs button:hover:not(:disabled) {
  background: var(--panel-strong);
  color: var(--text);
}

.group-management-tabs button.selected {
  border-bottom-color: var(--accent);
  color: var(--accent);
}

.group-management-toggle,
.group-management-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.group-management-toggle strong {
  display: block;
  color: var(--text);
}

.group-details-row {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto auto;
  gap: 12px;
  align-items: end;
}

.group-title-field {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
}

.group-title-field input {
  width: 100%;
  min-width: 0;
}

.group-info-field {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}

.group-info-field textarea {
  width: 100%;
  min-width: 0;
  resize: vertical;
}

.group-info-text {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 10px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.group-management-row-actions {
  grid-template-columns: minmax(0, 1fr) auto;
}

.group-management-toggle small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.group-management-toggle input {
  width: 22px;
  height: 22px;
}

.group-management-row {
  grid-template-columns: minmax(180px, 1fr) auto auto;
}

.group-management-row input {
  min-width: 0;
}

.group-known-members {
  display: grid;
  gap: 8px;
}

.group-known-member {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 8px;
  cursor: pointer;
}

.group-known-member:hover,
.group-known-member:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--focus-ring);
}

.group-known-member-identity:focus-visible {
  outline: none;
}

.group-known-member-identity {
  min-width: 0;
}

.group-known-member-identity strong {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.group-known-member-identity strong span:last-child {
  min-width: 0;
}

.group-known-member-identity span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-known-member-identity span,
.group-known-members-empty {
  color: var(--muted);
  font-size: 13px;
}

.group-known-member-identity .group-known-member-status {
  color: var(--accent);
  font-weight: 700;
}

.group-member-admin-star {
  flex: 0 0 auto;
  color: #f59e0b;
  font-size: 16px;
  line-height: 1;
}

.group-known-member-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.group-invite-contact-list {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.group-invite-contact-title {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.group-invite-contact {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  border-color: var(--line);
  background: var(--panel);
  text-align: left;
}

.group-invite-contact.selected {
  border-color: var(--accent);
  background: var(--accent-strong);
  color: #ffffff;
}

.group-invite-contact-text {
  display: grid;
  min-width: 0;
}

.group-invite-contact-text strong,
.group-invite-contact-text span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-invite-contact-text span,
.group-invite-contact-empty {
  color: var(--muted);
  font-size: 13px;
}

.group-invite-contact.selected .group-invite-contact-text span {
  color: rgba(255, 255, 255, .78);
}

.group-member-menu-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  border-color: transparent;
  background: transparent;
  color: #111827;
  padding: 0;
  opacity: 0;
  transition: opacity .15s ease, transform .15s ease;
}

.group-known-member:hover .group-member-menu-button,
.group-known-member:focus-within .group-member-menu-button,
.group-member-menu-button:focus-visible {
  opacity: 1;
}

.group-member-menu-button:hover:not(:disabled),
.group-member-menu-button:focus-visible {
  border-color: transparent;
  background: transparent;
  color: var(--accent-strong);
  box-shadow: none;
  outline: none;
  transform: translateY(1px);
}

.group-member-menu-symbol {
  display: block;
  width: 14px;
  height: 9px;
  background: currentColor;
  mask: url("assets/icons/chevron-down-icon.svg") center / contain no-repeat;
  -webkit-mask: url("assets/icons/chevron-down-icon.svg") center / contain no-repeat;
}

.group-member-role-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--accent);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 700;
}

.group-member-role-badge-danger {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

@media (max-width: 640px) {
  .group-management-toggle,
  .group-details-row,
  .group-management-row,
  .group-known-member {
    grid-template-columns: 1fr;
  }

  .group-management-toggle input,
  .group-details-row .avatar,
  .group-management-row button,
  .group-known-member-actions {
    justify-self: start;
  }
}

@media (hover: none) {
  .group-member-menu-button {
    opacity: 1;
  }
}

.contact-profile-body {
  display: grid;
  gap: 14px;
}

.contact-profile-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.contact-profile-heading strong {
  display: block;
  color: var(--text);
  font-size: 22px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.contact-profile-heading span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.contact-profile-details {
  display: grid;
  gap: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.contact-profile-details div {
  display: grid;
  grid-template-columns: minmax(110px, 36%) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 10px 12px;
  background: rgba(255, 255, 255, .03);
}

.contact-profile-details div + div {
  border-top: 1px solid var(--line);
}

.contact-profile-details dt {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.contact-profile-details dd {
  margin: 0;
  color: var(--text);
  overflow-wrap: anywhere;
}

.link-button.account-forgot-password {
  justify-self: start;
  min-height: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0;
  font-weight: 700;
  text-decoration: underline;
}

.link-button.account-forgot-password:hover,
.link-button.account-forgot-password:focus-visible {
  background: transparent;
  color: var(--accent-strong);
}

.dialog-status {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #132034;
  color: #dbeafe;
  padding: 8px 10px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.modal-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
}

.location-share-card {
  width: min(720px, calc(100vw - 32px));
}

.location-share-body {
  display: grid;
  gap: 12px;
}

.location-share-map {
  width: 100%;
  min-height: min(440px, 52vh);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b1220;
}

.location-share-duration {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}

#accountDialogTitle:focus {
  outline: none;
  box-shadow: none;
}

.account-start-dialog .account-dialog-card {
  width: min(440px, calc(100vw - 32px));
}

@media (max-width: 720px) {
  body.account-gate .app-shell {
    display: none;
  }

  body.account-gate #accountDialog.account-start-dialog {
    padding: 0;
    align-items: start;
  }

  body.account-gate #accountDialog.account-start-dialog .account-dialog-card {
    width: 100%;
    min-width: 0;
    height: var(--visual-viewport-height, 100dvh);
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  body.account-gate #accountDialog.account-start-dialog .modal-header {
    padding: max(24px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 20px max(20px, env(safe-area-inset-left));
    background: var(--panel);
  }

  body.account-gate #accountDialog.account-start-dialog .modal-header h2 {
    font-size: 26px;
  }

  body.account-gate #accountDialog.account-start-dialog .modal-body {
    display: block;
    padding: 20px max(20px, env(safe-area-inset-right)) 16px max(20px, env(safe-area-inset-left));
    overscroll-behavior: contain;
  }

  body.account-gate #accountDialog.account-start-dialog .dialog-status {
    margin-bottom: 20px;
  }

  body.account-gate #accountDialog.account-start-dialog #dialogRealAccountTitle {
    display: none;
  }

  #accountDialog input:not([type="checkbox"]):not([type="radio"]),
  #accountDialog select,
  #accountDialog textarea {
    min-width: 0;
    min-height: 48px;
    font-size: 16px;
  }

  body.account-gate #accountDialog.account-start-dialog .modal-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px;
    gap: 10px;
    padding: 16px max(20px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    background: var(--panel);
  }

  body.account-gate #accountDialog.account-start-dialog .modal-actions button {
    min-width: 0;
    min-height: 48px;
    margin: 0;
    font-size: 16px;
  }

  body.account-gate #accountDialog.account-start-dialog #dialogConnectButton {
    grid-column: 1 / -1;
    grid-row: 1;
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
  }
}

.account-start-dialog.server-settings-visible .account-dialog-card {
  width: min(720px, calc(100vw - 32px));
}

.account-start-dialog .modal-body {
  display: grid;
  gap: 12px;
}

.account-start-dialog .account-start-hidden {
  display: none;
}

.account-start-dialog .account-profile-section,
.account-start-dialog .account-settings-section,
.account-start-dialog .account-preferences-section {
  display: none;
}

.account-start-dialog .account-advanced {
  display: none;
}

.account-start-dialog.server-settings-visible .account-advanced {
  display: grid;
}

.account-start-dialog .account-dialog-grid {
  grid-template-columns: 1fr;
}

.account-start-dialog .dialog-status {
  min-height: 0;
}

.account-start-dialog .modal-actions {
  align-items: stretch;
}

.account-start-dialog .modal-actions button {
  flex: 1 1 0;
}

.dialog-server-settings-button {
  flex: 0 0 38px;
  margin-left: auto;
}

.account-start-dialog .modal-actions .dialog-server-settings-button {
  flex: 0 0 38px;
  margin-left: 0;
}

.social-login-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  grid-column: 1 / -1;
}

.google-sdk-login-wrap {
  position: relative;
  width: 44px;
  height: 44px;
}

.google-sdk-login-button {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 44px;
  visibility: hidden;
  pointer-events: none;
}

.google-sdk-login-wrap.sdk-ready .google-sdk-login-button {
  position: static;
  visibility: visible;
  pointer-events: auto;
}

.google-sdk-login-wrap.sdk-ready .google-login-button {
  display: none;
}

.google-sdk-login-wrap.sdk-ready:hover .google-login-button,
.google-sdk-login-wrap.sdk-ready:focus-within .google-login-button {
  --social-button-bg: #202124;
  --social-button-hover-bg: #202124;
  --social-button-border: #202124;
  --social-button-hover-border: #202124;
  display: inline-flex;
  position: absolute;
  inset: 0;
  z-index: 3;
  border-color: #202124;
  background: #202124;
  box-shadow: 0 0 0 2px #d2e3fc;
}

.google-sdk-login-wrap.sdk-ready:hover .google-login-mark,
.google-sdk-login-wrap.sdk-ready:focus-within .google-login-mark {
  background: #202124;
}

.google-sdk-login-button > div,
.google-sdk-login-button iframe {
  max-width: 100%;
}

.google-sdk-login-overlay {
  appearance: none;
  -webkit-appearance: none;
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: transparent;
  cursor: pointer;
}

.google-sdk-login-overlay:hover,
.google-sdk-login-overlay:active {
  background: transparent;
  box-shadow: none;
  outline: 0;
}

.google-sdk-login-overlay:focus,
.google-sdk-login-overlay:focus-visible {
  background: transparent;
  box-shadow: none;
  outline: 0;
}

.google-sdk-login-overlay[hidden] {
  display: none;
}

.social-login-button {
  --social-button-border: var(--border-strong);
  --social-button-bg: var(--surface);
  --social-button-color: var(--text);
  --social-button-hover-border: var(--social-button-border);
  --social-button-hover-bg: var(--social-button-bg);
  --social-button-hover-color: var(--social-button-color);
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--social-button-border);
  border-radius: 999px;
  background: var(--social-button-bg);
  color: var(--social-button-color);
  font-weight: 700;
  padding: 0;
}

.social-login-button:hover,
.social-login-button:focus-visible {
  border-color: var(--social-button-hover-border);
  background: var(--social-button-hover-bg);
  color: var(--social-button-hover-color);
}

.social-login-mark {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #fff;
  border: 0;
  color: #1a73e8;
}

.social-login-mark svg {
  display: block;
  width: 22px;
  height: 22px;
}

.google-login-button {
  --google-button-border: #747775;
  --google-button-bg: #fff;
  --google-button-text: #1f1f1f;
  --google-button-focus-bg: #202124;
  --google-button-focus-border: #202124;
  --google-button-hover-ring: #d2e3fc;
  --social-button-border: var(--google-button-border);
  --social-button-bg: var(--google-button-bg);
  --social-button-color: var(--google-button-text);
  --social-button-hover-border: var(--google-button-focus-border);
  --social-button-hover-bg: var(--google-button-focus-bg);
  --social-button-hover-color: var(--google-button-text);
  justify-content: center;
  font-family: Roboto, Arial, sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
}

.google-login-button:hover {
  --social-button-hover-border: var(--google-button-focus-border);
  --social-button-hover-bg: var(--google-button-focus-bg);
  box-shadow: 0 0 0 2px var(--google-button-hover-ring);
}

.google-login-button:focus-visible {
  --social-button-hover-border: var(--google-button-focus-border);
  --social-button-hover-bg: var(--google-button-focus-bg);
  box-shadow: 0 0 0 2px var(--google-button-hover-ring);
}

.google-login-mark {
  flex: 0 0 20px;
  background: transparent;
}

.facebook-login-mark {
  border: 0;
  background: transparent;
  color: var(--facebook-blue);
}

.facebook-login-glyph {
  fill: var(--facebook-glyph-color);
}

.facebook-login-button {
  --facebook-blue: #1877f2;
  --facebook-blue-hover: #166fe5;
  --facebook-button-border: #747775;
  --facebook-button-bg: #fff;
  --facebook-glyph-color: var(--facebook-blue);
  --social-button-border: var(--facebook-button-border);
  --social-button-bg: var(--facebook-button-bg);
  --social-button-color: var(--facebook-blue);
  --social-button-hover-border: var(--facebook-blue-hover);
  --social-button-hover-bg: var(--facebook-blue-hover);
  --social-button-hover-color: #fff;
}

.facebook-login-button:hover,
.facebook-login-button:focus-visible {
  --facebook-glyph-color: #fff;
}

.facebook-login-button:hover .facebook-login-glyph,
.facebook-login-button:focus-visible .facebook-login-glyph {
  fill: var(--facebook-glyph-color);
}

.profile-dialog .account-auth-section,
.profile-dialog .account-settings-section,
.profile-dialog .account-advanced {
  display: none;
}

.settings-dialog .account-auth-section,
.settings-dialog .account-profile-section {
  display: none;
}

.account-menu-dialog.profile-dialog .account-profile-section.active-settings-panel {
  display: block;
}

.account-menu-dialog.settings-dialog .account-advanced {
  display: block;
}

.account-menu-dialog .account-advanced summary {
  display: none;
}

.server-setting-readonly {
  opacity: .72;
}

input.server-setting-readonly,
select.server-setting-readonly {
  cursor: not-allowed;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  place-items: center;
  min-width: 34px;
  width: 34px;
  padding: 0;
  font-weight: 700;
  line-height: 1;
}

.icon-button.call-mode-button,
.icon-button.call-media-icon-button,
.icon-button.disconnect-icon-button {
  border-color: #6aa2ff;
  background: rgba(237, 244, 255, .92);
  color: #174a8b;
}

.icon-button.call-mode-button:disabled,
.icon-button.call-media-icon-button:disabled {
  border-color: #b6d1fb;
  background: rgba(237, 244, 255, .82);
  color: #526d8f;
  opacity: 1;
}

.icon-button.call-mode-button:hover:not(:disabled) {
  background: var(--accent-strong);
  color: #ffffff;
}

.icon-button.call-mode-button.selected {
  background: var(--accent-strong);
  color: #ffffff;
}

.icon-button.call-media-icon-button:hover:not(:disabled) {
  background: #dbeafe;
  color: #0f3f7c;
}

.icon-button.call-mode-button:hover:not(:disabled) .material-icon,
.icon-button.call-mode-button:focus-visible .material-icon,
.icon-button.call-mode-button.selected .material-icon,
.icon-button.call-mode-button:hover:not(:disabled) .material-icon-svg,
.icon-button.call-mode-button:focus-visible .material-icon-svg,
.icon-button.call-mode-button.selected .material-icon-svg {
  color: #ffffff;
  fill: #ffffff;
}

.icon-label-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.tool-icon-button {
  min-width: 40px;
  width: 40px;
  height: 34px;
}

.material-icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
  color: currentColor;
  flex: 0 0 auto;
}

.material-icon svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.material-icon-svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.call-mode-button .material-icon,
.call-media-icon-button .material-icon,
.disconnect-icon-button .material-icon {
  width: 22px;
  height: 22px;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101820;
  color: var(--text);
  padding: 8px 10px;
}

.file-input {
  display: none;
}

textarea {
  resize: vertical;
  min-height: 96px;
}

.call-contacts-toggle[hidden],
.call-contacts-close[hidden],
.call-contacts-backdrop[hidden],
.call-contacts-edge[hidden] {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr);
  height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #314159;
  background: #151f2d;
  padding: 8px 18px 8px 14px;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand-logo {
  display: block;
  flex: 0 1 270px;
  width: min(270px, 34vw);
  height: 42px;
  border-radius: 6px;
  object-fit: contain;
  object-position: left center;
}

.brand-status {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.brand h1,
.chat-header h2,
.tab-panel-header h2,
.settings-section h2 {
  margin: 0;
}

.brand h1 {
  font-size: 17px;
}

.avatar {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 999px;
  background: var(--avatar-bg);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.avatar img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
  object-position: center;
}

.avatar-header {
  width: 44px;
  height: 44px;
  font-size: 16px;
}

.avatar-large {
  width: 58px;
  height: 58px;
  font-size: 20px;
}

.brand span,
.chat-header span,
.send-row,
.conversation-item span,
.remote-draft span {
  color: var(--muted);
  font-size: 12px;
}

.conversation-item .avatar {
  color: #ffffff;
  font-size: 13px;
}

.top-actions,
.button-row,
.composer-tools,
.send-row,
.section-heading,
.mode-switch,
.app-tabs,
.tab-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-actions-toggle {
  display: none;
}

.top-actions {
  min-width: 0;
  flex: 0 0 auto;
  justify-content: flex-end;
  overflow: visible;
}

.client-grid {
  --conversation-list-width: 420px;
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(260px, 420px);
  align-content: stretch;
  min-height: 0;
  background: #0b1220;
}

.client-grid::before {
  content: "";
  position: absolute;
  inset: 0 0 0 var(--conversation-list-width);
  z-index: 0;
  background-color: #0b1220;
  background-image:
    linear-gradient(var(--chat-background-overlay), var(--chat-background-overlay)),
    var(--chat-background-image);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  pointer-events: none;
}

body.conversation-open .client-grid {
  grid-template-columns: var(--conversation-list-width) minmax(0, 1fr);
}

body.developer-mode.conversation-open .client-grid {
  grid-template-columns: var(--conversation-list-width) minmax(0, 1fr) 330px;
}

body.history-page-active .client-grid,
body.history-page-active.conversation-open .client-grid,
body.history-page-active.developer-mode.conversation-open .client-grid {
  grid-template-columns: minmax(0, 1fr);
}

body.history-page-active .client-grid::before {
  inset: 0;
  background: #f8fbff;
  background-image: none;
}

.conversation-list,
.detail-panel {
  position: relative;
  z-index: 1;
  min-width: 0;
  overflow: auto;
  background: #151f2d;
}

.conversation-list {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  min-height: 0;
  overflow: hidden;
  border-right: 0;
  padding: 12px;
}

.conversation-list[data-contact-directory="sip"] > :is(.conversation-search:not(.sip-directory-search), .conversation-items),
.conversation-list:not([data-contact-directory="sip"]) > .sip-directory-search {
  display: none;
}

.contact-directory-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

body .contact-directory-tabs button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding-inline: 4px;
  border-color: transparent;
  border-radius: 10px;
  background: transparent;
}

body .contact-directory-tabs button[aria-pressed="true"] {
  background: var(--selection-bg);
  color: var(--selection-text);
  border-color: var(--selection-border);
}

.contact-directory-tabs svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.sip-directory {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
}

.sip-directory-contacts {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sip-directory > [role="status"]:empty {
  margin: 0;
}

.sip-contact-call-row {
  display: flex;
  align-items: center;
}

.sip-contact-call-row .sip-contact-menu-trigger {
  width: auto;
  min-width: 0;
}

.sip-contact-menu-trigger {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 10px;
  text-align: start;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.sip-contact-context-menu button {
  min-height: 44px;
}

.sip-directory-form input,
.sip-contact-dialog-actions button {
  min-height: 44px;
}

.sip-contact-dialog {
  width: min(420px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  color: var(--text);
}

.sip-contact-dialog::backdrop {
  background: rgba(5, 12, 24, .58);
}

.sip-contact-dialog h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.sip-directory-form {
  display: grid;
  gap: 6px;
}

.sip-directory-form input {
  width: 100%;
  min-width: 0;
}

.sip-directory-form [role="alert"] {
  margin: 0;
}

.sip-contact-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

body:not(.conversation-open):not(.call-active):not(.history-page-active) .app-shell {
  height: var(--visual-viewport-height, 100dvh);
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
}

body.conversation-open .conversation-list {
  border-right: 1px solid #314159;
}

body.history-page-active .conversation-list,
body.history-page-active .detail-panel {
  display: none;
}

.history-page {
  position: relative;
  z-index: 1;
  display: grid;
  grid-column: 1 / -1;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background: #f8fbff;
  padding: 20px 24px;
}

body.history-page-active .history-page {
  display: grid;
}

body.history-page-active .chat-panel {
  display: none !important;
}

.detail-panel {
  display: none;
  flex-direction: column;
  border-left: 1px solid #314159;
  padding: 12px;
  gap: 12px;
}

body.developer-mode .detail-panel {
  display: flex;
}

.developer-only {
  display: none;
}

body.developer-mode .developer-only {
  display: inline-flex;
}

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

.conversation-search {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  border: 1px solid #c9d8ef;
  border-radius: 8px;
  background: rgba(255, 255, 255, .82);
  padding: 7px 10px;
  color: #48617f;
}

.conversation-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .18);
}

.conversation-search .material-icon {
  width: 18px;
  height: 18px;
  color: inherit;
}

.conversation-search input {
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  color: #0f172a;
  outline: 0;
}

.conversation-search input:focus,
.conversation-search input:focus-visible {
  outline: 0;
  box-shadow: none;
}

.conversation-search input::placeholder {
  color: #6b7c94;
}

.conversation-items {
  display: grid;
  gap: 6px;
  align-content: start;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
}

.conversation-empty {
  margin: 8px 4px;
  color: #48617f;
  font-size: 14px;
}

.conversation-actions {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

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

.conversation-actions-footer {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  margin-bottom: env(safe-area-inset-bottom, 0px);
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.conversation-actions-footer .conversation-actions {
  position: absolute;
  z-index: 5;
  right: 0;
  bottom: calc(100% + 6px);
  width: min(260px, 100%);
  margin: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}

.conversation-actions-footer .conversation-actions button {
  min-height: 44px;
  text-align: left;
}

body .conversation-actions-footer .conversation-add-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 10px;
  border: 0;
  background: var(--accent-strong);
  color: #fff;
}

body .conversation-list:not([data-contact-directory="sip"]) #sipDirectoryAdd,
body .conversation-list[data-contact-directory="sip"] #conversationActionsToggle {
  display: none;
}

.conversation-actions .danger-action:not(:disabled) {
  border-color: #ef4444;
}

.conversation-actions .danger-action:not(:disabled):hover,
.conversation-actions .danger-action.selected {
  background: #b91c1c;
  color: #ffffff;
}

.conversation-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) minmax(94px, auto);
  align-items: center;
  column-gap: 8px;
  width: 100%;
  text-align: left;
}

.conversation-item,
.sip-contact-menu-trigger {
  border-color: transparent;
  background: transparent;
}

.conversation-item.blocked {
  opacity: .78;
}

.conversation-item.blocked .avatar {
  filter: grayscale(1);
}

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

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

.conversation-row-meta {
  display: grid;
  grid-template-columns: minmax(42px, auto) minmax(22px, auto) 10px;
  align-items: center;
  justify-content: end;
  column-gap: 10px;
  min-width: 94px;
}

.conversation-time {
  justify-self: end;
  color: #48617f;
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}

.conversation-time[hidden] {
  display: none;
}

.conversation-unread-badge {
  display: inline-grid;
  place-items: center;
  justify-self: end;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--accent-strong);
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff;
  padding: 0 7px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.conversation-unread-badge[hidden] {
  display: none;
}

.presence-dot {
  justify-self: end;
  width: 10px;
  height: 10px;
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 999px;
  background: #ef4444;
}

.presence-online {
  background: #22c55e;
}

.presence-offline {
  background: #ef4444;
}

.presence-group {
  background: #60a5fa;
}

.presence-blocked {
  background: #ef4444;
}

.conversation-item.selected,
.sip-contact-menu-trigger.selected {
  background: var(--selection-bg);
  border-color: var(--selection-border);
  color: var(--selection-text);
}

.conversation-item.selected span {
  color: var(--selection-muted);
}

.conversation-item.selected .conversation-time {
  color: rgba(255, 255, 255, .78);
}

.conversation-item.selected .conversation-unread-badge {
  border: 1px solid rgba(255, 255, 255, .85);
  background: #2563eb;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .22);
}

.conversation-item.selected .avatar {
  color: #ffffff;
}

.chat-panel {
  position: relative;
  z-index: 1;
  display: none;
  grid-template-rows: auto auto auto auto minmax(0, 1fr) auto auto;
  min-width: 0;
  min-height: 0;
  background-color: #0f1724;
  background-image:
    linear-gradient(var(--chat-background-overlay), var(--chat-background-overlay)),
    var(--chat-background-image);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

body.conversation-open .chat-panel {
  display: grid;
}

.back-to-contacts {
  display: none;
}

.drop-overlay {
  position: absolute;
  inset: 12px;
  z-index: 10;
  display: grid;
  place-items: center;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  background: rgba(15, 23, 36, .88);
  color: #fff;
  pointer-events: none;
}

.drop-overlay[hidden] {
  display: none;
}

.drop-overlay div {
  display: grid;
  gap: 6px;
  max-width: 360px;
  border: 1px solid #6aa2ff;
  border-radius: var(--radius);
  background: #132034;
  padding: 18px 22px;
  text-align: center;
  box-shadow: 0 18px 42px rgba(0, 0, 0, .38);
}

.drop-overlay strong {
  font-size: 20px;
}

.drop-overlay span {
  color: #dbeafe;
}

.app-tabs {
  grid-row: 1;
  overflow-x: auto;
  border-bottom: 1px solid rgba(49, 65, 89, .38);
  padding: 8px 14px;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(6px);
}

.app-tabs button {
  white-space: nowrap;
}

.chat-header {
  grid-row: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(49, 65, 89, .38);
  background: rgba(255, 255, 255, .68);
  backdrop-filter: blur(6px);
  padding: 12px 14px;
}

.chat-title {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.chat-title > div:last-child {
  min-width: 0;
}

.chat-title h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-header-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.call-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.call-mode-buttons {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.call-mode-button {
  min-width: 38px;
  width: 38px;
  height: 34px;
}

.disconnect-icon-button,
.hangup-icon-button {
  border-color: #ef4444 !important;
  background: #dc2626 !important;
  color: #ffffff !important;
}

.call-answer-button,
.call-reject-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  font-weight: 800;
}

.call-answer-button {
  border-color: #22c55e !important;
  background: #15803d !important;
  color: #ffffff !important;
}

.call-reject-button {
  border-color: #ef4444 !important;
  background: #dc2626 !important;
  color: #ffffff !important;
}

.call-answer-button:hover:not(:disabled) {
  background: #166534 !important;
  color: #ffffff !important;
}

.call-reject-button:hover:not(:disabled) {
  background: #b91c1c !important;
  color: #ffffff !important;
}

.disconnect-icon-button:not(:disabled),
.hangup-icon-button:not(:disabled) {
  box-shadow: inset 0 -2px 0 rgba(220, 38, 38, .7);
}

.disconnect-icon-button .material-icon,
.hangup-icon-button .material-icon,
.disconnect-icon-button .material-icon-svg,
.hangup-icon-button .material-icon-svg {
  color: #ffffff !important;
  fill: #ffffff !important;
}

.disconnect-icon-button:hover:not(:disabled),
.hangup-icon-button:hover:not(:disabled) {
  background: #b91c1c !important;
  color: #ffffff !important;
}

.call-panel-hangup-button {
  width: 46px;
  min-width: 46px;
  height: 38px;
}

.total-conversation-button {
  box-shadow: inset 0 -2px 0 rgba(32, 201, 112, .65);
}

.translation-settings {
  grid-column: 1 / -1;
  min-width: 0;
  max-width: 720px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.translation-settings > * + * {
  margin-top: 12px;
}

.translation-settings p {
  font-size: 13px;
  line-height: 1.5;
}

.message-translation {
  border-top: 1px solid var(--line);
  padding-top: 3px;
  margin-top: 4px;
  clear: both;
}

.interpreter-button { position: relative; flex-shrink: 0; }
.interpreter-badge { position: absolute; top: -4px; right: -4px; min-width: 18px; padding: 2px; border-radius: 50%; background: #b42318; color: #fff; font-size: 11px; }
.interpreter-banner { position: fixed; top: 90px; right: 16px; width: min(380px, calc(100vw - 32px)); padding: 16px; background: var(--panel, #fff); color: var(--text, #172b4d); border: 1px solid #5b9bf4; border-radius: 12px; box-shadow: 0 8px 28px #0004; z-index: 150; }
.interpreter-banner p { margin: 0 0 12px; line-height: 1.5; }
.interpreter-banner button { margin: 4px; min-height: 44px; }
.call-panel .interpreter-tile { position: absolute; z-index: 2; inset: 6px 31% 52px 6px; background: #07111f; border: 2px solid #3b82f6; border-radius: 8px; overflow: hidden; }
.call-panel #interpreterVideo { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.interpreter-caption { position: absolute; left: 0; right: 0; top: 0; padding: 5px; background: #07111fd9; color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 12px; }
.interpreter-caption button { font-size: 11px; padding: 4px 7px; min-height: 32px; }
.interpreter-rtt { position: absolute; bottom: 0; left: 0; right: 0; padding: 4px 8px; background: #07111fe6; color: #fff; max-height: 30%; overflow: auto; pointer-events: none; }
.interpreter-rtt:has(p:empty):not(:has(p:not(:empty))) { display: none; }
.interpreter-rtt p { white-space: pre-wrap; overflow-wrap: anywhere; margin: 2px 0; font-size: 14px; }
.call-panel #interpreterCameraPreview { position: absolute; bottom: 30px; right: 6px; width: 25%; height: 25%; min-height: 0; object-fit: contain; }
.interpreter-camera-toggle { position: absolute; bottom: 0; right: 0; font-size: 11px; }

.message-translation-result {
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message-translation-result small {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
}

.live-rtt-translation {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  margin-top: 4px;
  padding: 3px 0 0;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.35;
  color: var(--text);
}

.live-rtt-translation,
.message-translation > .message-translation-result {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  column-gap: 8px;
}

.message-translation-result > small,
.message-translation-result > .translation-info[open] {
  grid-column: 1 / -1;
}

.message-translation-result:has(> .translation-info[open]) > div {
  grid-column: 1 / -1;
}

.live-rtt-translation small {
  color: var(--muted);
  font-size: 12px;
}

.live-rtt-translation-progress {
  margin: 6px 0 0;
}

.translation-info {
  margin: 0;
  padding: 0;
  border: 0;
  white-space: normal;
}

.translation-info > summary {
  display: block;
  width: fit-content;
  min-height: 24px;
  padding: 2px 0;
  font-size: 12px;
  line-height: 20px;
  font-weight: 400;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  list-style: none;
}

.translation-info > summary::-webkit-details-marker {
  display: none;
}

.translation-info > summary:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.translation-notice {
  display: block;
  min-width: 0;
  margin-top: 4px;
  padding-top: 3px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
}

.translation-notice > summary {
  min-height: 24px;
  cursor: pointer;
  text-decoration: underline;
}

.translation-notice button {
  min-height: 44px;
  white-space: normal;
}

#remoteDraftTranslation:empty,
#totalConversationRemoteTranslation:empty,
#totalConversationLocalTranslation:empty {
  display: none;
}

.tc-text-line .live-rtt-translation {
  color: #f8fafc;
  background: transparent;
  border-color: #24528a;
}

.tc-text-line .live-rtt-translation small {
  color: #bfdbfe;
}

body.call-active .call-panel .tc-text-panel .tc-text-line.has-live-translation {
  overflow: auto;
  pointer-events: auto;
}

body.call-active .call-panel:not(.tc-text-full) .tc-text-panel .tc-text-line.has-live-translation,
body.viewport-phone.call-active .call-panel.tc-text-full .tc-text-panel .tc-text-line.has-live-translation {
  max-height: clamp(160px, 32dvh, 240px) !important;
}

body.viewport-phone.viewport-portrait.tc-text-visible-active.call-active .call-panel:has(.has-live-translation) {
  grid-template-rows: minmax(100px, 22dvh) auto auto !important;
}

.rtt-toolbar-button {
  border-style: dashed;
}

.rtt-toolbar-button.selected {
  border-style: solid;
  box-shadow: inset 0 -2px 0 rgba(32, 201, 112, .75);
}

.call-menu {
  position: relative;
  display: inline-flex;
}

.call-menu-trigger {
  min-width: 118px;
}

.call-menu-panel {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 40;
  display: grid;
  gap: 4px;
  min-width: 160px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  background: var(--panel);
  box-shadow: 0 16px 36px rgba(0, 0, 0, .28);
}

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

.call-menu-panel button {
  justify-content: flex-start;
  width: 100%;
  text-align: left;
}

.composer-call-menu .call-menu-panel {
  top: auto;
  bottom: calc(100% + 4px);
}

.call-status {
  min-width: 120px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.incoming-call {
  grid-row: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #2f6fed;
  padding: 14px 16px;
  background: linear-gradient(90deg, rgba(37, 99, 235, .22), rgba(32, 201, 112, .16));
  box-shadow: inset 4px 0 0 var(--good);
}

.incoming-call[hidden] {
  display: none;
}

.incoming-call div:first-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.incoming-call strong {
  color: var(--text);
  font-size: 16px;
}

.incoming-call span {
  color: var(--muted);
}

.incoming-call-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.incoming-call-dialog {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  overflow-y: auto;
  background: rgba(5, 12, 24, .58);
}

.incoming-call-dialog[hidden] {
  display: none;
}

.incoming-call-card {
  display: grid;
  gap: 12px;
  width: min(420px, 100%);
  border: 1px solid #6aa2ff;
  border-radius: var(--radius);
  padding: 22px;
  background: var(--panel);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .42);
}

.incoming-call-card strong {
  font-size: 22px;
}

.incoming-call-card > span {
  color: var(--muted);
}

.incoming-call-card .incoming-call-actions {
  margin-top: 8px;
}

.incoming-call-card .incoming-call-actions button {
  flex: 1 1 0;
  min-height: 44px;
}

.call-panel {
  grid-row: 4;
  position: relative;
  display: grid;
  min-height: 210px;
  border-bottom: 1px solid #314159;
  background: #07111f;
  overflow: hidden;
}

.call-keypad-dialog {
  width: min(340px, calc(100vw - 32px));
  max-height: calc(100dvh - max(16px, env(safe-area-inset-top)) - max(16px, env(safe-area-inset-bottom)));
  overflow-y: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  color: var(--text);
}

.call-keypad-dialog::backdrop {
  background: rgba(5, 12, 24, .58);
}

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

.call-keypad-heading h2 {
  margin: 0;
  font-size: 20px;
}

.call-keypad-heading button {
  min-width: 44px;
  min-height: 44px;
  font-size: 24px;
}

.call-keypad-keys {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.call-keypad-keys button {
  min-height: 48px;
  font-size: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.call-keypad-letters {
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: .1em;
}

#callKeypadTextButton {
  width: 100%;
  min-height: 44px;
}

body.call-active .call-panel {
  height: var(--call-panel-height, clamp(260px, 42vh, 420px));
  min-height: 0;
  max-height: none;
}

body.call-active .call-panel.local-video-main:not(.no-remote-video) {
  height: 170px;
  max-height: 170px;
}

body.tc-text-full-active .call-panel {
  grid-row: 4 / 6;
  min-height: 0;
}

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

.call-audio-placeholder {
  display: none;
}

.call-panel.no-call-video:not(.tc-text-full):not(.has-interpreter) .call-audio-placeholder {
  display: grid;
  grid-row: 1;
  grid-column: 1;
  place-content: center;
  justify-items: center;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding: 12px;
  color: #eaf2ff;
  font-size: 18px;
}

.call-panel video {
  width: 100%;
  height: 100%;
  min-height: 210px;
  background: #050b14;
  object-fit: contain;
}

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

body.call-active .call-panel video {
  min-height: 0;
}

.call-panel #localVideo {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 4;
  width: min(180px, 32%);
  height: auto;
  min-height: 0;
  aspect-ratio: 16 / 9;
  border: 1px solid #6aa2ff;
  border-radius: var(--radius);
  background: #0b1220;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .32);
}

.call-panel.local-video-main #remoteVideo {
  display: none;
}

.call-panel.local-video-main #localVideo {
  position: static;
  width: 100%;
  height: 100%;
  min-height: 0;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  object-fit: contain;
  box-shadow: none;
}

.call-panel #localVideo.camera-off {
  opacity: .58;
  filter: grayscale(1);
}

.call-panel.no-remote-video {
  height: auto;
  min-height: 0;
  max-height: none;
  padding: 12px 14px 14px;
  overflow: hidden;
}

body.call-active .call-panel.no-remote-video.local-video-main {
  display: block;
  height: var(--call-panel-height, clamp(260px, 42vh, 420px));
  min-height: 0;
  max-height: none;
  padding: 0;
  overflow: hidden;
}

.call-resize-handle {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  height: 12px;
  cursor: ns-resize;
  touch-action: none;
}

.call-resize-handle::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 72px;
  height: 3px;
  border-radius: 999px;
  background: rgba(219, 234, 254, .72);
  transform: translateX(-50%);
  box-shadow: 0 1px 5px rgba(15, 23, 42, .35);
}

body.call-resizing {
  cursor: ns-resize;
  user-select: none;
}

.call-panel.no-remote-video.local-video-main #localVideo {
  position: static;
  width: 100%;
  height: 100%;
  min-height: 0;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  object-fit: contain;
  box-shadow: none;
}

.call-panel video.portrait-video {
  object-fit: contain;
}

.call-panel.no-remote-video .tc-text-panel {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 76px;
  z-index: 3;
  margin: 0;
  padding: 0;
  pointer-events: auto;
}

.call-panel.no-remote-video .call-media-controls {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 3;
  max-width: calc(100% - 28px);
  width: auto;
  margin: 0;
}

.call-media-controls {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  max-width: calc(100% - 220px);
  border: 1px solid rgba(106, 162, 255, .65);
  border-radius: var(--radius);
  padding: 8px;
  background: rgba(7, 17, 31, .84);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .28);
  backdrop-filter: blur(8px);
}

.call-media-icon-button {
  width: 38px;
  height: 36px;
  border-color: #22c55e !important;
  background: #16a34a !important;
  color: #ffffff !important;
}

.call-media-icon-button.selected {
  border-color: #ef4444 !important;
  background: #dc2626 !important;
  color: #ffffff !important;
}

.call-media-icon-button:disabled {
  border-color: #7f1d1d !important;
  background: #991b1b !important;
  color: #ffffff !important;
  opacity: 1;
}

.call-device-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.call-device-select {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #dbeafe;
  font-size: 12px;
  white-space: nowrap;
}

.call-device-symbol {
  width: 18px;
  height: 18px;
  color: #dbeafe;
}

.call-device-select select {
  width: 104px;
  min-width: 0;
  height: 30px;
  border: 1px solid rgba(147, 197, 253, .65);
  border-radius: 6px;
  padding: 0 22px 0 8px;
  appearance: none;
  background: #f8fbff;
  color: #0f172a;
  font: inherit;
}

.call-device-select::after {
  content: "";
  position: absolute;
  right: 8px;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #1e3a8a;
  pointer-events: none;
}

.ios-facing-control {
  display: none !important;
}

body.device-ios .call-device-select.ios-facing-control {
  display: inline-flex !important;
}

body.device-ios .call-device-select.ios-hidden-call-device {
  display: none !important;
}

body.device-ios .ios-hidden-device-setting {
  display: none !important;
}

body.device-ios .call-device-select.ios-facing-control {
  justify-content: center;
  width: 38px;
  min-width: 38px;
  height: 34px;
  border: 0;
  background: transparent;
}

.call-facing-toggle {
  width: 38px;
  min-width: 38px;
  height: 34px;
  border: 1px solid rgba(147, 197, 253, .65);
  border-radius: 8px;
  background: #f8fbff;
  color: #0f172a;
}

.call-facing-toggle .call-device-symbol {
  width: 24px;
  height: 24px;
  color: #0f172a;
}

body.device-ios .call-device-select.ios-facing-control select {
  display: none;
}

body.device-ios .call-device-select.ios-facing-control::after {
  display: none;
}

body.device-ios .settings-section label.ios-facing-control,
body.device-ios .account-dialog-grid label.ios-facing-control {
  display: grid !important;
}

.volume-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #dbeafe;
  font-size: 13px;
  white-space: nowrap;
}

.volume-control input {
  width: 110px;
}

.volume-control output {
  min-width: 38px;
  color: #dbeafe;
  text-align: right;
}

.tc-text-panel {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 72px;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  pointer-events: none;
}

.call-panel.has-local-video:not(.local-video-main) .tc-text-panel {
  right: min(220px, calc(34% + 28px));
}

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

.tc-text-line {
  display: grid;
  gap: 4px;
  min-height: 54px;
  border: 1px solid rgba(106, 162, 255, .72);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: rgba(7, 17, 31, .82);
  color: #ffffff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .28);
  backdrop-filter: blur(8px);
}

.tc-text-line span {
  color: #93c5fd;
  font-size: 12px;
  font-weight: 700;
}

.tc-text-line p {
  margin: 0;
  min-height: 22px;
  color: #f8fafc;
  font-size: 16px;
  line-height: 1.25;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tc-text-lines {
  display: grid;
  gap: 2px;
}

#totalConversationLocalText {
  pointer-events: auto;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 72px;
  margin: 0;
  padding: 4px;
  resize: none;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 16px;
  line-height: 1.3;
}

#totalConversationLocalText::placeholder {
  color: #cbd5e1;
  opacity: 1;
}

#totalConversationLocalText:focus,
#totalConversationLocalText:focus-visible {
  outline: none;
  box-shadow: none;
}

html body.call-active.tc-call-active #composerForm,
html body.call-active.tc-call-active .message-timeline,
html body.call-active.tc-call-active #remoteDraft {
  display: none !important;
}

html body.call-active.tc-call-active #callPanel,
html body.call-active.tc-call-active #callPanel .call-media-controls,
html body.call-active.tc-call-active #callPanel .live-rtt-translation {
  border-color: transparent;
  box-shadow: none;
}

html body.call-active.tc-call-active #callPanel .tc-text-line {
  border-color: #24528a;
  box-shadow: none;
}

html body.call-active.tc-call-active #totalConversationLocalText {
  border-color: transparent;
  box-shadow: none;
}

.tc-text-line p[hidden] {
  display: none;
}

.call-panel.tc-text-full #totalConversationLocalText {
  min-height: 110px;
  font-size: clamp(20px, 2.2vw, 34px);
}

body.tc-phone-keyboard-active #callPanel #totalConversationLocalText {
  min-height: 32px;
  height: 36px;
  font-size: 16px;
}

.tc-text-lines p:first-child {
  color: #cbd5e1;
  font-size: 15px;
}

.tc-text-lines p:last-of-type {
  color: #ffffff;
  font-weight: 700;
}

.tc-text-line p:empty::before {
  content: "...";
  color: #94a3b8;
}

.call-panel.tc-text-full video {
  display: none;
}

.call-panel.tc-text-full .tc-text-panel {
  --desktop-call-menu-text-inset: 14px;
  top: 14px;
  bottom: 72px;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  pointer-events: auto;
}

body.call-menu-active:not(.viewport-phone):not(.device-tablet) #callPanel:not(.has-interpreter):not(:has(> .call-media-controls)) .tc-text-panel {
  bottom: var(--desktop-call-menu-text-inset, 8px);
}

.call-panel.tc-text-full .call-resize-handle {
  display: none;
}

.call-panel.tc-text-full .tc-text-line {
  min-height: 0;
  align-content: start;
  overflow: auto;
  padding: 12px 14px;
}

.call-panel.tc-text-full .tc-text-line span {
  font-size: 13px;
}

.call-panel.tc-text-full .tc-text-line p {
  font-size: clamp(20px, 2.2vw, 34px);
  line-height: 1.3;
}

.call-panel.tc-text-full .tc-text-lines p:first-child {
  font-size: clamp(16px, 1.6vw, 24px);
}

body.tc-text-full-active .message-timeline {
  display: none;
}

body.tc-text-visible-active.call-active .message-timeline,
body.tc-text-visible-active.call-active .remote-draft {
  display: none;
}

body.tc-call-active.call-active .message-timeline,
body.tc-call-active.call-active .remote-draft {
  display: none;
}

body.tc-text-visible-active.call-active .call-panel {
  grid-row: 4 / 6;
  height: var(--call-panel-height, auto);
  max-height: none;
}

body.tc-call-active.call-active .call-panel {
  grid-row: 4 / 6;
  height: var(--call-panel-height, auto);
  max-height: none;
}

body.tc-text-visible-active.call-active .call-panel.no-remote-video.local-video-main {
  grid-template-rows: minmax(220px, 1fr) auto auto;
  height: var(--call-panel-height, auto);
  max-height: none;
}

body.tc-call-active.call-active .call-panel.no-remote-video.local-video-main {
  grid-template-rows: minmax(220px, 1fr) auto auto;
  height: var(--call-panel-height, auto);
  max-height: none;
}

.message-timeline {
  grid-row: 5;
  min-height: 0;
  overflow: auto;
  background: transparent;
  padding: 16px;
}

.scroll-to-latest-button {
  position: absolute;
  right: 24px;
  bottom: 86px;
  z-index: 8;
  width: 42px;
  min-width: 42px;
  height: 42px;
  border: 1px solid rgba(148, 163, 184, .42);
  border-radius: 999px;
  background: rgba(255, 255, 255, .94);
  color: #0f172a;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .28), 0 2px 6px rgba(15, 23, 42, .16), inset 0 1px 0 rgba(255, 255, 255, .72);
  backdrop-filter: blur(8px);
}

.scroll-to-latest-button:hover:not(:disabled),
.scroll-to-latest-button:focus-visible {
  background: #ffffff;
  color: #2563eb;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .32), 0 3px 8px rgba(15, 23, 42, .18), 0 0 0 2px rgba(96, 165, 250, .34), inset 0 1px 0 rgba(255, 255, 255, .86);
}

.scroll-to-latest-symbol {
  display: block;
  width: 18px;
  height: 12px;
  background: currentColor;
  filter: drop-shadow(0 1px 1px rgba(15, 23, 42, .28));
  mask: url("assets/icons/chevron-down-icon.svg") center / contain no-repeat;
  -webkit-mask: url("assets/icons/chevron-down-icon.svg") center / contain no-repeat;
}

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

body.tc-text-full-active .scroll-to-latest-button,
body.tc-text-visible-active.call-active .scroll-to-latest-button,
body.tc-call-active.call-active .scroll-to-latest-button {
  display: none;
}

body[data-chat-background="auto"],
body[data-chat-background="wide-1"] {
  --chat-background-image: url("assets/backgrounds/teletyptel-bg-wide-1.png");
}

body[data-chat-background="wide-2"] {
  --chat-background-image: url("assets/backgrounds/teletyptel-bg-wide-2.png");
}

body[data-chat-background="wide-3"] {
  --chat-background-image: url("assets/backgrounds/teletyptel-bg-wide-3.png");
}

body[data-chat-background="mobile"] {
  --chat-background-image: url("assets/backgrounds/teletyptel-bg-mobile.png");
}

body[data-chat-background="none"] {
  --chat-background-image: none;
}

body:not([data-chat-background="none"]) .message-body {
  backdrop-filter: blur(2px);
}

.no-conversation {
  display: grid;
  gap: 8px;
  place-self: center;
  max-width: 360px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.no-conversation strong {
  color: var(--text);
  font-size: 18px;
}

.composer-disabled {
  opacity: .74;
}

.tab-panel {
  grid-row: 5;
  grid-column: 1 / -1;
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.tab-panel-header {
  justify-content: space-between;
  border-bottom: 1px solid #314159;
  margin-bottom: 14px;
  padding-bottom: 10px;
}

.tab-panel-body {
  display: grid;
  gap: 12px;
}

.provider-card {
  display: grid;
  gap: 8px;
  border: 1px solid #3f536d;
  border-radius: var(--radius);
  background: #18253a;
  padding: 12px;
}

.tab-panel.history-panel {
  background: #f8fbff;
}

.history-card.provider-card {
  gap: 14px;
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #0f172a;
  padding: 0;
}

.history-page .tab-panel-header {
  width: 100%;
  max-width: none;
}

.history-page .tab-panel-body {
  width: 100%;
}

.provider-card dl {
  display: grid;
  grid-template-columns: minmax(90px, auto) 1fr;
  gap: 6px 12px;
  margin: 0;
}

.provider-card dt {
  color: var(--muted);
}

.provider-card dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.blocked-contact-list,
.archive-contact-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.blocked-contact-empty,
.archive-contact-empty {
  margin: 0;
  color: var(--muted);
}

.blocked-contact-row,
.archive-contact-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid #3f536d;
  border-radius: var(--radius);
  background: #132034;
  padding: 8px;
}

.blocked-contact-row .avatar {
  filter: grayscale(1);
}

.blocked-contact-text,
.archive-contact-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.blocked-contact-text strong,
.blocked-contact-text span,
.archive-contact-text strong,
.archive-contact-text span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.blocked-contact-text span,
.archive-contact-text span {
  color: var(--muted);
}

.location-panel {
  display: grid;
  gap: 10px;
  border: 1px solid #3f536d;
  border-radius: var(--radius);
  background: rgba(19, 32, 52, .72);
  padding: 12px;
}

.location-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.location-header span {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.location-actions {
  align-items: center;
  flex-wrap: wrap;
}

.location-actions .icon-button {
  min-width: 40px;
  width: 40px;
}

.location-duration-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.location-duration-control select {
  width: auto;
  min-width: 112px;
  padding: 6px 8px;
}

.location-warnings {
  display: grid;
  gap: 6px;
}

.location-warnings span {
  border-left: 3px solid var(--warn);
  background: rgba(240, 180, 41, .12);
  color: #fde68a;
  padding: 6px 8px;
}

.location-details {
  border-top: 1px solid #3f536d;
  padding-top: 8px;
}

.history-settings {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  border: 1px solid #bfd7ff;
  border-radius: var(--radius);
  background: #eef5ff;
  padding: 10px;
}

.history-toggle,
.history-retention {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #0f172a;
  font-size: 14px;
}

.history-toggle input {
  width: auto;
}

.history-retention select {
  width: auto;
  min-width: 128px;
  padding: 6px 8px;
}

.history-privacy-help {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.history-help-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  border-radius: 6px;
  padding: 0 !important;
  font-weight: 800;
}

.history-privacy-card {
  width: min(620px, calc(100vw - 32px));
}

.history-privacy-body {
  color: var(--text);
  line-height: 1.45;
}

.history-privacy-body p {
  margin: 0;
}

.history-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 14px;
  min-height: 360px;
}

.history-list,
.history-detail {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  min-width: 0;
  border: 1px solid #bfd7ff;
  border-radius: var(--radius);
  background: #ffffff;
  padding: 10px;
}

.history-list {
  display: grid;
  align-content: start;
  gap: 8px;
  overflow: auto;
  overflow-x: hidden;
}

.history-group {
  color: #64748b;
  font-size: 12px;
  text-transform: uppercase;
}

.history-item {
  display: grid;
  gap: 5px;
  align-items: start;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 52px;
  height: auto;
  overflow: hidden;
  border: 1px solid #bfd7ff;
  border-radius: 8px;
  background: #eef5ff;
  color: #0f172a;
  padding: 10px;
  line-height: 1.3;
  text-align: left;
}

.history-item.selected {
  border-color: #2563eb;
  background: #2563eb;
  color: #ffffff;
}

.history-item.selected .history-item-title,
.history-item.selected .history-item-meta,
.history-item.selected .history-item-preview {
  color: #ffffff;
}

.history-item-title,
.history-detail h3 {
  font-weight: 800;
}

.history-item-title,
.history-item-meta,
.history-item-preview {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item-meta {
  font-size: 13px;
}

.history-item-meta,
.history-item-preview,
.history-detail-meta,
.history-empty {
  color: #475569;
}

.history-item-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-detail {
  display: grid;
  align-content: start;
  gap: 10px;
  overflow: auto;
}

.history-detail h3,
.history-detail p {
  margin: 0;
}

.history-actions {
  display: flex;
  gap: 8px;
}

.history-transcript {
  display: grid;
  gap: 8px;
}

.history-media {
  display: grid;
  gap: 8px;
}

.history-media .attachment-card {
  margin-top: 0;
  max-width: min(720px, 100%);
}

.history-transcript-line {
  display: grid;
  gap: 3px;
  border: 1px solid #d8e6ff;
  border-radius: 8px;
  background: #f8fbff;
  padding: 8px;
}

.history-transcript-line p,
.history-message-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  .history-layout {
    grid-template-columns: 1fr;
  }

  .history-list {
    max-height: 34vh;
  }
}

.location-card {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  border: 1px solid #5c7598;
  border-radius: var(--radius);
  background: rgba(32, 201, 112, .12);
  padding: 8px;
  overflow: hidden;
  cursor: zoom-in;
}

.location-card span {
  color: var(--muted);
  font-size: 12px;
}

.location-card a {
  color: #93c5fd;
}

.location-card-map {
  display: block;
  width: 100%;
  min-height: 240px;
  border: 1px solid rgba(147, 197, 253, .42);
  border-radius: 8px;
  background: #0b1220;
  pointer-events: none;
  touch-action: none;
}

.location-map-preview {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
}

.location-position-marker {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 3px solid #fff;
  border-radius: 999px;
  background: var(--avatar-bg, #2563eb);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  box-shadow: 0 0 0 5px rgba(37, 99, 235, .22), 0 6px 16px rgba(15, 23, 42, .42);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.location-position-marker::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 12px;
  height: 12px;
  border-right: 3px solid #fff;
  border-bottom: 3px solid #fff;
  border-radius: 0 0 4px 0;
  background: inherit;
  box-shadow: 4px 4px 8px rgba(15, 23, 42, .22);
  transform: translateX(-50%) rotate(45deg);
  z-index: -1;
}

.location-position-marker img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.location-map-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.location-map-links a {
  border: 1px solid rgba(147, 197, 253, .58);
  border-radius: 8px;
  padding: 5px 8px;
  background: rgba(37, 99, 235, .14);
  text-decoration: none;
}

.location-map-links a:hover {
  background: rgba(37, 99, 235, .24);
}

.map-viewer-shell {
  position: fixed;
  inset: 0;
  z-index: 121;
  display: grid;
  place-items: center;
  background: rgba(2, 6, 23, .72);
  padding: 18px;
}

.map-viewer-shell[hidden] {
  display: none;
}

.map-viewer-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1120px, calc(100vw - 36px));
  height: min(780px, calc(100vh - 36px));
  border: 1px solid #79a8ff;
  border-radius: 12px;
  background: #081220;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
  overflow: hidden;
}

.map-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #31517c;
  background: #10203a;
  color: #fff;
  padding: 10px 12px;
}

.map-viewer-header > div:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.map-viewer-header span {
  color: #b8cff2;
  font-size: 12px;
}

.map-viewer-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.map-viewer-actions button,
.map-viewer-actions .icon-button {
  min-height: 32px;
  background: #edf4ff;
  color: #0b3b78;
}

.map-viewer-actions button.selected {
  background: #2563eb;
  color: #fff;
}

.map-viewer-canvas {
  position: relative;
  overflow: hidden;
  background: #dbe7f4;
}

.map-viewer-tiles {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.map-viewer-tiles iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.map-viewer-position-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  font-size: 14px;
  transform: translate(-50%, -50%);
}

.map-viewer-canvas.google-active .map-viewer-position-dot,
.map-viewer-canvas.embed-active .map-viewer-position-dot {
  display: none;
}

.map-viewer-google-marker {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 3px solid #fff;
  border-radius: 999px;
  background: var(--avatar-bg, #2563eb);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  box-shadow: 0 0 0 5px rgba(37, 99, 235, .22), 0 6px 16px rgba(15, 23, 42, .42);
}

.map-viewer-google-marker::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 12px;
  height: 12px;
  border-right: 3px solid #fff;
  border-bottom: 3px solid #fff;
  border-radius: 0 0 4px 0;
  background: inherit;
  transform: translateX(-50%) rotate(45deg);
  z-index: -1;
}

.map-viewer-google-marker img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.map-viewer-external {
  border-top: 1px solid #31517c;
  background: #10203a;
  color: #dbeafe;
  padding: 9px 12px;
  text-decoration: none;
}

.map-viewer-external:hover {
  color: #fff;
}

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

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

.announcement-item {
  display: grid;
  gap: 5px;
  border: 1px solid #3f536d;
  border-radius: var(--radius);
  background: rgba(19, 32, 52, .72);
  padding: 10px;
}

.announcement-item p {
  margin: 0;
}

.announcement-meta {
  color: var(--muted);
  font-size: 12px;
}

.announcement-item a {
  color: #93c5fd;
}

.protocol-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
  margin: 10px 0 12px;
}

.protocol-summary-item {
  display: grid;
  gap: 2px;
  border: 1px solid #3f536d;
  border-radius: var(--radius);
  background: rgba(37, 99, 235, .14);
  padding: 9px 10px;
}

.protocol-summary-item strong {
  color: #93c5fd;
  font-size: 20px;
  line-height: 1;
}

.protocol-summary-item span {
  color: var(--muted);
  font-size: 12px;
}

.checklist {
  display: grid;
  gap: 8px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.checklist li {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  border: 1px solid #3f536d;
  border-radius: var(--radius);
  padding: 8px 10px;
  background: rgba(19, 32, 52, .72);
}

.checklist-mark {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  font-weight: 700;
}

.checklist li.done .checklist-mark {
  background: rgba(32, 201, 112, .18);
  color: var(--good);
}

.checklist li.open .checklist-mark {
  background: rgba(240, 180, 41, .16);
  color: var(--warn);
}

.message {
  display: grid;
  gap: 4px;
  max-width: min(76ch, 84%);
  margin-bottom: 12px;
}

.message-date-separator {
  display: flex;
  justify-content: center;
  margin: 8px 0 14px;
}

.message-date-separator span {
  border: 1px solid rgba(61, 91, 128, .18);
  border-radius: 8px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 1px 4px rgba(15, 23, 42, .08);
  color: #475569;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

body[data-theme="dark"] .message-date-separator span {
  border-color: rgba(148, 163, 184, .28);
  background: rgba(15, 23, 42, .86);
  color: #cbd5e1;
}

.message.self {
  margin-left: auto;
}

.message.with-avatar {
  grid-template-columns: 34px minmax(0, 1fr);
  column-gap: 10px;
  align-items: start;
  max-width: min(72ch, calc(84% - 56px));
  margin-left: 12px;
}

.message.with-avatar.self {
  grid-template-columns: minmax(0, 1fr) 34px;
  margin-left: auto;
  margin-right: 12px;
}

.message.with-avatar .message-avatar {
  position: relative;
  z-index: 2;
  width: 30px;
  height: 30px;
  align-self: start;
  margin-top: 20px;
  color: #ffffff;
  font-size: 12px;
}

.message.with-avatar.has-bubble-tail .message-avatar {
  margin-top: 4px;
}

.avatar-clickable,
.message-avatar-clickable {
  cursor: pointer;
}

.avatar-clickable:hover,
.avatar-clickable:focus-visible,
.message-avatar-clickable:hover,
.message-avatar-clickable:focus-visible {
  box-shadow: 0 0 0 3px rgba(79, 140, 255, .28);
}

.message.with-avatar .message-content {
  position: relative;
  justify-self: start;
  display: grid;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
}

.message.with-avatar .message-content::before {
  content: "";
  position: absolute;
  inset: 0 -48px;
  z-index: 0;
}

.message.with-avatar .message-content > * {
  position: relative;
  z-index: 1;
}

.message.with-avatar.self .message-avatar {
  grid-column: 2;
  grid-row: 1;
}

.message.with-avatar.self .message-content {
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
}

.message.with-avatar.self .message-meta {
  text-align: right;
}

.message.has-inline-meta > .message-meta,
.message.has-inline-meta .message-content > .message-meta {
  display: none;
}

.message-group-sender-label {
  display: block;
  margin: 0 0 4px;
  color: #0f766e;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message.self .message-group-sender-label {
  color: #166534;
}

.message-text-content {
  display: inline;
}

.message.draft .message-body {
  border-style: dashed;
}

.message.retracted .message-body {
  border-style: dashed;
  background: rgba(148, 163, 184, .16);
  color: var(--muted);
  font-style: italic;
}

.message-body {
  display: flow-root;
  position: relative;
  max-width: 100%;
  border: 1px solid #3f536d;
  border-radius: var(--radius);
  background: var(--bubble-peer);
  padding: 8px 10px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message.with-avatar.has-bubble-tail:not(.self) .message-body::before,
.message.with-avatar.has-bubble-tail:not(.self) .message-body::after,
.message.with-avatar.has-bubble-tail.self .message-body::before,
.message.with-avatar.has-bubble-tail.self .message-body::after {
  content: "";
  position: absolute;
  top: 11px;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  pointer-events: none;
}

.message.with-avatar.has-bubble-tail:not(.self) .message-body::before {
  left: -9px;
  border-right: 9px solid #3f536d;
}

.message.with-avatar.has-bubble-tail:not(.self) .message-body::after {
  left: -7px;
  border-right: 8px solid var(--bubble-peer);
}

.message.with-avatar.has-bubble-tail.self .message-body::before {
  right: -9px;
  border-left: 9px solid #1d8d68;
}

.message.with-avatar.has-bubble-tail.self .message-body::after {
  right: -7px;
  border-left: 8px solid var(--bubble-self);
}

.message-body code {
  border: 1px solid rgba(79, 140, 255, .35);
  border-radius: 4px;
  background: rgba(79, 140, 255, .12);
  padding: 1px 4px;
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: .95em;
}

.call-message-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: min(100%, 360px);
  min-width: 0;
}

.call-message-icon {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .72);
  color: #0f766e;
}

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

.call-message-card.missed .call-message-icon {
  color: #dc2626;
}

.call-message-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

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

.call-message-text strong {
  color: #0f172a;
  font-size: 15px;
}

.call-message-text span {
  color: #334155;
  font-size: 13px;
}

.call-message-history-button {
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(37, 99, 235, .45);
  border-radius: 999px;
  background: rgba(239, 246, 255, .9);
  color: #1d4ed8;
  cursor: pointer;
  width: 34px;
  height: 34px;
  padding: 0;
}

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

.call-message-history-button:hover,
.call-message-history-button:focus-visible {
  background: #dbeafe;
  outline: 2px solid rgba(37, 99, 235, .35);
  outline-offset: 2px;
}

.message-link {
  color: #0f766e;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

body[data-theme="dark"] .message-link {
  color: #93c5fd;
}

body[data-theme="dark"] .link-preview-card {
  border-color: #5c7598;
  background: rgba(30, 41, 59, .76);
  color: #f8fafc;
}

body[data-theme="dark"] .link-preview-card:hover {
  border-color: var(--accent);
  background: rgba(51, 65, 85, .82);
}

body[data-theme="dark"] .link-preview-text small {
  color: #cbd5e1;
}

body[data-theme="dark"] .link-preview-site,
body[data-theme="dark"] .link-preview-url,
body[data-theme="dark"] .link-preview-loading {
  color: #94a3b8;
}

.message-style-strikethrough {
  text-decoration-thickness: 2px;
}

.attachment-card {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  border: 1px solid #5c7598;
  border-radius: var(--radius);
  background: rgba(79, 140, 255, .12);
  color: var(--text);
  padding: 8px;
}

.attachment-card:hover {
  border-color: var(--accent);
  background: rgba(79, 140, 255, .2);
}

.link-preview-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  margin-top: 8px;
  border: 1px solid rgba(15, 118, 110, .28);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .72);
  color: #102033;
  padding: 8px;
  text-decoration: none;
  white-space: normal;
}

.link-preview-card:hover {
  border-color: rgba(15, 118, 110, .52);
  background: rgba(255, 255, 255, .9);
}

.link-preview-card.no-image {
  grid-template-columns: minmax(0, 1fr);
}

.link-preview-image {
  width: 96px;
  height: 72px;
  border-radius: 6px;
  object-fit: cover;
  background: #0b1220;
}

.link-preview-text {
  display: grid;
  min-width: 0;
  gap: 4px;
  align-content: center;
}

.link-preview-text strong,
.link-preview-text small,
.link-preview-site,
.link-preview-url,
.link-preview-loading {
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-preview-text strong,
.link-preview-text small {
  display: -webkit-box;
  -webkit-box-orient: vertical;
}

.link-preview-text strong {
  -webkit-line-clamp: 2;
}

.link-preview-text small {
  color: #475569;
  -webkit-line-clamp: 2;
}

.link-preview-site,
.link-preview-url,
.link-preview-loading {
  color: #64748b;
  font-size: 12px;
}

.link-preview-url,
.link-preview-loading {
  grid-column: 1 / -1;
  white-space: nowrap;
}

.attachment-card.photo {
  align-items: stretch;
  padding: 6px;
}

.attachment-card.document .attachment-icon {
  background: #2563eb;
}

.attachment-card.binary .attachment-icon {
  background: #7c2d12;
}

.attachment-card.file .attachment-icon {
  background: #475569;
}

.attachment-card.audio,
.attachment-card.video {
  display: block;
  position: relative;
  padding: 6px;
}

.attachment-card.video {
  width: min(100%, 510px);
  box-sizing: border-box;
  border-color: #5c7598;
  background: transparent;
  padding: 3px;
  overflow: hidden;
}

.attachment-card.audio .attachment-icon {
  background: #f97316;
}

.attachment-card.video .attachment-icon {
  background: #7c3aed;
}

.attachment-audio-player,
.attachment-video-player {
  width: 100%;
  min-width: 0;
  margin-top: 0;
}

.attachment-video-stage {
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  aspect-ratio: 16 / 9;
  height: clamp(145px, 27vw, 282px);
  max-height: none;
  border: 0;
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(219, 234, 254, .96), rgba(240, 253, 244, .94));
}

.attachment-video-player {
  display: block;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  background: transparent;
  opacity: 1;
  transition: opacity .12s ease;
}

.attachment-video-stage.video-preview-loading .attachment-video-player {
  opacity: 0;
}

.attachment-video-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #2563eb;
  pointer-events: none;
}

.attachment-video-placeholder .material-icon-svg {
  width: 48px;
  height: 48px;
}

.attachment-video-stage.video-preview-ready .attachment-video-placeholder {
  display: none;
}

.attachment-preview {
  width: 86px;
  height: 64px;
  border-radius: 6px;
  object-fit: cover;
  background: #0b1220;
}

.attachment-card.photo {
  cursor: zoom-in;
}

.photo-viewer-shell {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  background: rgba(2, 6, 23, .76);
  padding: 18px;
}

.photo-viewer-shell[hidden] {
  display: none;
}

.photo-viewer-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1080px, calc(100vw - 36px));
  height: min(760px, calc(100vh - 36px));
  border: 1px solid #79a8ff;
  border-radius: 12px;
  background: #081220;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
  overflow: hidden;
}

.photo-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #31517c;
  background: #10203a;
  color: #fff;
  padding: 10px 12px;
}

.photo-viewer-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.photo-viewer-actions .icon-button {
  min-width: 36px;
  min-height: 32px;
  background: #edf4ff;
  color: #0b3b78;
}

.photo-viewer-canvas {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, .04) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, .04) 25%, transparent 25%),
    #030712;
  background-size: 24px 24px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.photo-viewer-canvas.dragging {
  cursor: grabbing;
}

.photo-viewer-canvas img {
  position: absolute;
  top: 50%;
  left: 50%;
  max-width: none;
  max-height: none;
  transform-origin: center;
  will-change: transform;
  user-select: none;
  pointer-events: none;
}

.attachment-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 38px;
  border-radius: 6px;
  background: var(--accent-strong);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.attachment-text {
  display: grid;
  min-width: 0;
}

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

.attachment-text small {
  color: var(--muted);
}

.message.self .message-body {
  background: var(--bubble-self);
  border-color: #1d8d68;
}

.message-meta {
  color: var(--muted);
  font-size: 12px;
}

.message-inline-meta {
  float: right;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin: 4px 0 0 10px;
  color: #64748b;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.message.self .message-inline-meta {
  color: #15803d;
}

.message-receipt {
  display: inline-block;
  color: #64748b;
  font-weight: 700;
  letter-spacing: 0;
  vertical-align: baseline;
}

.message-receipt-delivered,
.message-receipt-displayed {
  letter-spacing: -0.32em;
  padding-inline-end: 0.32em;
}

.message-receipt-displayed {
  color: #0ea5e9;
}

.message-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.message-actions button {
  min-height: 26px;
  padding: 3px 9px;
  font-size: 12px;
}

.message-body-wrap {
  position: relative;
  display: grid;
  justify-self: start;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
}

.message.self .message-body-wrap {
  justify-self: end;
}

.message-body-wrap:has(.attachment-card),
.message-body-wrap:has(.call-message-card),
.message-body-wrap:has(.location-card) {
  width: min(560px, 100%);
}

.message-body:has(.attachment-card),
.message-body:has(.call-message-card),
.message-body:has(.location-card) {
  width: 100%;
}

.message-body-wrap:has(.message-reactions:not([hidden])) {
  margin-bottom: 13px;
}

.message-reaction-button {
  position: absolute;
  top: 50%;
  right: -44px;
  z-index: 2;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  min-height: 34px;
  border-color: rgba(79, 140, 255, .35);
  border-radius: 999px;
  background: rgba(255, 255, 255, .86);
  color: #475569;
  padding: 0;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) scale(.94);
  transition: opacity .12s ease, transform .12s ease;
}

.message.self .message-reaction-button {
  right: auto;
  left: -44px;
  justify-self: end;
}

.message-reaction-button .material-icon-svg {
  width: 20px;
  height: 20px;
}

.message-reaction-button:hover,
.message-reaction-button:focus-visible {
  background: #ffffff;
  color: #0f172a;
}

.message:hover .message-reaction-button,
.message:focus-within .message-reaction-button,
.message-reaction-button:focus-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) scale(1);
}

@media (hover: none), (pointer: coarse) {
  .message-reaction-button {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) scale(1);
  }
}

.message-reactions {
  position: absolute;
  bottom: -13px;
  left: 10px;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: calc(100% - 20px);
}

.message.self .message-reactions {
  right: 10px;
  left: auto;
  justify-content: flex-end;
}

.message-reaction-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 24px;
  border-color: rgba(79, 140, 255, .32);
  border-radius: 999px;
  background: rgba(255, 255, 255, .9);
  padding: 1px 8px;
  font-size: 15px;
  line-height: 1;
}

.message-reaction-chip .smiley-image {
  max-width: 20px;
  height: 20px;
  margin: 0;
}

.message-reaction-count {
  font-size: 12px;
  font-weight: 700;
}

.message-reaction-picker {
  position: fixed;
  z-index: 60;
  display: flex;
  gap: 4px;
  border: 1px solid rgba(61, 91, 128, .22);
  border-radius: 999px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 12px 28px rgba(15, 23, 42, .24);
  padding: 5px;
}

.message-reaction-picker button {
  width: 34px;
  height: 34px;
  min-height: 34px;
  border-color: transparent;
  border-radius: 999px;
  background: transparent;
  padding: 0;
  font-size: 21px;
  line-height: 1;
}

.message-reaction-picker button:hover,
.message-reaction-picker button:focus-visible {
  border-color: #22c55e;
  background: rgba(34, 197, 94, .12);
}

body[data-theme="dark"] .message-reaction-button,
body[data-theme="dark"] .message-reaction-chip,
body[data-theme="dark"] .message-reaction-picker {
  border-color: rgba(148, 163, 184, .28);
  background: rgba(15, 23, 42, .92);
  color: #e2e8f0;
}

.smiley {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 22px;
  border: 1px solid #5c7598;
  border-radius: 6px;
  background: #0b1220;
  color: #dbeafe;
  font-size: 12px;
  margin: 0 1px;
  padding: 0 5px;
  vertical-align: middle;
}

.smiley-image {
  display: inline-block;
  width: auto;
  max-width: 28px;
  height: 22px;
  margin: 0 2px;
  object-fit: contain;
  vertical-align: text-bottom;
}

.remote-draft {
  grid-row: 6;
  border-top: 1px solid #314159;
  background: #18253a;
  padding: 8px 14px;
}

.remote-draft-lines {
  display: grid;
  gap: 2px;
}

.remote-draft p {
  margin: 4px 0 0;
  color: var(--remote-draft-text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.remote-draft-lines p:first-child {
  color: var(--muted);
  font-size: 14px;
}

.remote-draft-lines p:last-of-type {
  color: var(--remote-draft-text);
  font-size: 17px;
  font-weight: 700;
}

.composer {
  grid-row: 7;
  border-top: 0;
  background: transparent;
  padding: 8px 16px 10px;
}

.composer-tools,
.send-row {
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.composer-tools {
  justify-content: flex-start;
}

.send-row {
  justify-content: space-between;
}

.composer-input-row {
  position: relative;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #ffffff;
  padding: 5px 8px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .18), 0 1px 2px rgba(15, 23, 42, .10);
  transition: border-color .16s ease, box-shadow .16s ease;
}

.composer-input-row textarea {
  min-width: 0;
  min-height: 36px;
  max-height: 132px;
  border: 0;
  background: transparent;
  padding: 8px 6px;
  color: #0f172a;
  font-size: 16px;
  resize: none;
}

.composer-input-row textarea:focus {
  outline: none;
}

.composer-input-row textarea:focus-visible {
  outline: none;
  box-shadow: none;
}

.composer-input-row:focus-within {
  border-color: transparent;
  box-shadow: 0 3px 10px rgba(15, 23, 42, .20), 0 1px 2px rgba(15, 23, 42, .12);
}

.composer-round-button,
.composer-send-button {
  width: 36px;
  min-width: 36px;
  height: 36px;
  border-color: transparent;
  border-radius: 999px;
  background: #eef2f7;
  color: #0f172a;
}

.composer-round-button:hover:not(:disabled),
.composer-send-button:hover:not(:disabled) {
  background: #e2e8f0;
}

.composer-round-button[hidden],
.composer-send-button[hidden],
.composer-input-row[hidden] {
  display: none !important;
}

.composer-round-button.selected {
  background: rgba(79, 140, 255, .16);
  color: var(--accent-strong);
}

.composer-round-button.recording {
  border-color: #ef4444;
  background: #dc2626;
  color: #ffffff;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, .18);
}

.composer-send-button {
  background: var(--accent-strong);
  color: #ffffff;
}

.voice-preview-panel {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 8px 10px;
  align-items: center;
  margin-top: 0;
  padding: 6px 10px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: rgba(255, 255, 255, .98);
  color: #071526;
}

.voice-preview-panel.recording {
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 48px;
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 3px var(--focus-shadow);
}

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

.voice-preview-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 700;
  white-space: nowrap;
  color: #0b3b78;
}

.voice-preview-panel.preview-ready .voice-preview-meta {
  display: none;
}

.voice-preview-panel.recording .voice-preview-meta {
  display: flex;
}

.voice-preview-panel.recording .voice-preview-meta::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #e11d48;
  box-shadow: 0 0 0 4px rgba(225, 29, 72, .14);
  flex: 0 0 auto;
}

.voice-preview-panel.recording .voice-preview-meta .material-icon {
  display: none;
}

.voice-recording-wave {
  display: none;
  width: 180px;
  max-width: 34vw;
  height: 32px;
  margin-left: 10px;
  overflow: visible;
  flex: 0 1 180px;
}

.voice-preview-panel.recording .voice-recording-wave {
  display: block;
}

.voice-recording-wave rect {
  fill: #2563eb;
  rx: 1.4px;
  filter: drop-shadow(0 1px 2px rgba(37, 99, 235, .18));
  transition: height 70ms linear, y 70ms linear, opacity 70ms linear;
}

.voice-preview-meta .material-icon {
  width: 22px;
  height: 22px;
  color: #dc2626;
}

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

.voice-preview-panel audio[hidden] {
  display: none;
}

.voice-preview-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.voice-preview-panel.recording .voice-preview-actions {
  grid-column: auto;
}

.voice-action-button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  border-radius: 999px;
}

.voice-action-button .material-icon {
  width: 21px;
  height: 21px;
}

.voice-action-cancel {
  border-color: transparent;
  background: transparent;
  color: #111827;
}

.voice-action-cancel:hover {
  border-color: rgba(239, 68, 68, .35);
  background: rgba(239, 68, 68, .08);
  color: #b91c1c;
}

.attachment-download-button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  justify-self: end;
  border-color: rgba(79, 140, 255, .45);
  background: rgba(255, 255, 255, .62);
  color: #0f172a;
}

.attachment-download-button:hover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, .9);
}

.attachment-card.photo .attachment-download-button {
  align-self: start;
}

.attachment-card.audio .attachment-download-button,
.attachment-card.video .attachment-download-button {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
}

.voice-action-play {
  border-color: rgba(14, 165, 233, .32);
  background: rgba(14, 165, 233, .12);
  color: #0369a1;
}

.voice-action-play:hover {
  border-color: rgba(14, 165, 233, .5);
  background: rgba(14, 165, 233, .2);
}

.voice-action-repeat {
  border-color: rgba(37, 99, 235, .28);
  background: rgba(37, 99, 235, .1);
  color: #1d4ed8;
}

.voice-action-repeat:hover {
  border-color: rgba(37, 99, 235, .45);
  background: rgba(37, 99, 235, .16);
}

.voice-action-primary {
  border-color: var(--accent);
  background: var(--accent-strong);
  color: #ffffff;
}

.voice-action-primary.recording {
  border-color: #ef4444;
  background: #dc2626;
  color: #ffffff;
}

.video-preview-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 10px;
  align-items: center;
  margin-top: 0;
  padding: 8px;
  border: 1px solid var(--accent);
  border-radius: 14px;
  background: rgba(255, 255, 255, .98);
  color: #071526;
}

.video-preview-panel.preview-ready {
  border-radius: 999px;
  padding: 6px 10px;
}

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

.video-preview-panel.recording {
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 3px var(--focus-shadow);
}

.video-preview-summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  border: 0;
  background: transparent;
  color: #0b3b78;
  font-weight: 700;
  text-align: left;
}

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

.video-preview-summary .material-icon {
  width: 22px;
  height: 22px;
  color: #2563eb;
}

.video-preview-summary span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-preview-stage {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border-radius: 10px;
  background: #020617;
}

.video-preview-panel.preview-ready .video-preview-stage {
  display: none;
}

.video-preview-stage video {
  display: block;
  width: 100%;
  max-height: 260px;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #020617;
}

.video-preview-status {
  position: absolute;
  left: 8px;
  bottom: 8px;
  max-width: calc(100% - 16px);
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(2, 6, 23, .72);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.video-preview-actions {
  align-self: center;
}

.video-preview-dialog-shell {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background: rgba(2, 6, 23, .7);
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  overflow: auto;
}

.video-preview-dialog-shell[hidden] {
  display: none;
}

.video-preview-dialog-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  width: min(960px, calc(100vw - 48px));
  max-height: calc(min(100svh, var(--visual-viewport-height, 100svh)) - 32px);
  border: 1px solid rgba(147, 197, 253, .65);
  border-radius: 10px;
  background: #07111f;
  padding: 10px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .5);
  overflow: hidden;
}

.video-preview-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #eff6ff;
}

.video-preview-dialog-header strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-recorder-quality,
.video-recorder-camera {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  color: #dbeafe;
  font-size: 11px;
}

.video-recorder-camera {
  margin-right: 4px;
}

.video-recorder-quality {
  margin-right: auto;
}

.video-preview-dialog-card {
  position: relative;
}

.video-recorder-quality .material-icon,
.video-recorder-camera .material-icon {
  width: 17px;
  height: 17px;
  color: #cbd5e1;
}

.video-recorder-quality-native {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.video-quality-button,
.video-camera-button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  min-width: 84px;
  height: 24px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 7px 0 8px;
  background: #020617 !important;
  color: #ffffff !important;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  line-height: 1;
}

.video-camera-button {
  min-width: 96px;
  max-width: 150px;
}

.video-quality-button span,
.video-camera-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-quality-button:hover:not(:disabled),
.video-camera-button:hover:not(:disabled) {
  border-color: transparent;
  background: #0f172a !important;
  color: #ffffff !important;
}

.video-quality-button:active,
.video-quality-button[aria-expanded="true"],
.video-camera-button:active,
.video-camera-button[aria-expanded="true"] {
  border-color: transparent;
  background: #020617 !important;
  color: #ffffff !important;
}

.video-quality-button[aria-expanded="true"]::after,
.video-camera-button[aria-expanded="true"]::after {
  color: #60a5fa;
}

.video-quality-button::after,
.video-camera-button::after {
  content: "›";
  margin-left: 7px;
  color: #60a5fa;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
}

.video-quality-label {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  white-space: nowrap;
}

.video-quality-badge {
  color: #94a3b8;
  font-size: .62em;
  font-weight: 700;
  line-height: 1;
  transform: translateY(-.42em);
}

.video-quality-button:focus-visible,
.video-camera-button:focus-visible {
  outline: none;
  border-color: transparent;
  box-shadow: none;
}

.video-quality-button:disabled,
.video-camera-button:disabled {
  cursor: default;
  opacity: .65;
}

.video-quality-menu,
.video-camera-menu {
  position: absolute;
  bottom: 58px;
  left: 12px;
  z-index: 4;
  display: grid;
  gap: 2px;
  width: 142px;
  max-height: min(320px, calc(var(--visual-viewport-height, 100svh) - 180px));
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid rgba(148, 163, 184, .2);
  border-radius: 10px;
  background: rgba(15, 23, 42, .94);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .48);
  backdrop-filter: blur(10px);
  padding: 6px;
  justify-items: start;
}

.video-camera-menu {
  left: 116px;
  width: min(220px, calc(100% - 128px));
}

.video-quality-menu[hidden],
.video-camera-menu[hidden] {
  display: none;
}

.video-quality-menu .video-quality-option,
.video-camera-menu .video-camera-option {
  appearance: none;
  display: inline-grid;
  grid-template-columns: 18px auto;
  align-items: center;
  gap: 8px;
  justify-self: start;
  width: auto;
  min-height: 34px;
  border: 0 !important;
  border-radius: 7px;
  background: transparent !important;
  color: #e5edf7;
  cursor: pointer;
  padding: 0 10px;
  font: inherit;
  text-align: left;
  box-shadow: none !important;
}

.video-quality-menu .video-quality-option::before,
.video-camera-menu .video-camera-option::before {
  content: "";
  color: #ffffff;
  font-weight: 800;
}

.video-quality-menu .video-quality-option:hover,
.video-quality-menu .video-quality-option:focus-visible,
.video-camera-menu .video-camera-option:hover,
.video-camera-menu .video-camera-option:focus-visible {
  outline: none;
  background: rgba(15, 23, 42, .88) !important;
  color: #93c5fd;
}

.video-quality-menu .video-quality-option[aria-selected="true"],
.video-camera-menu .video-camera-option[aria-selected="true"] {
  background: #020617 !important;
  color: #60a5fa;
}

.video-quality-menu .video-quality-option[aria-selected="true"]::before,
.video-camera-menu .video-camera-option[aria-selected="true"]::before {
  content: "✓";
  color: #60a5fa;
}

.video-preview-dialog-card video {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: calc(min(100svh, var(--visual-viewport-height, 100svh)) - 154px);
  border-radius: 8px;
  background: #020617;
  object-fit: contain;
}

.video-preview-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-bottom: env(safe-area-inset-bottom);
}

.video-preview-dialog-actions .video-recorder-quality {
  margin-right: auto;
}

.video-preview-dialog-actions > button {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
}

@media (max-width: 640px) {
  .video-preview-panel {
    grid-template-columns: minmax(0, 1fr);
  }

  .video-preview-actions {
    justify-content: flex-end;
  }
}

body.viewport-phone .composer-input-row {
  grid-template-columns: auto auto minmax(0, 1fr) auto auto auto;
}

body.viewport-phone .composer-round-button,
body.viewport-phone .composer-send-button {
  width: 34px;
  min-width: 34px;
  height: 34px;
}

body.viewport-phone .voice-preview-panel {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  width: 100%;
  border-radius: 18px;
  padding: 6px;
}

body.viewport-phone .voice-preview-panel.recording {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-height: 46px;
  border-radius: 999px;
  padding: 5px 7px;
}

body.viewport-phone .voice-preview-panel.recording .voice-preview-meta {
  flex-wrap: nowrap;
  white-space: nowrap;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 6px;
  font-size: 13px;
  line-height: 1.25;
}

body.viewport-phone .voice-preview-panel.recording .voice-recording-wave {
  width: 100%;
  max-width: none;
  height: 28px;
  margin-left: 0;
  flex: 1 1 auto;
  justify-self: stretch;
}

body.viewport-phone .voice-preview-panel audio {
  width: 100%;
  max-width: 100%;
  height: 40px;
}

body.viewport-phone .voice-preview-panel.preview-ready .voice-preview-actions {
  flex-wrap: nowrap;
  justify-content: flex-end;
  width: auto;
}

body.viewport-phone .voice-preview-panel.preview-ready .voice-action-button {
  width: 38px;
  min-width: 38px;
  height: 38px;
}

body.viewport-phone .voice-preview-panel.recording .voice-preview-actions {
  flex-wrap: nowrap;
  justify-content: space-between;
  width: auto;
}

body.viewport-phone .voice-preview-panel.recording .voice-action-button {
  width: 38px;
  min-width: 38px;
  height: 38px;
}

body.viewport-phone .video-preview-panel {
  grid-template-columns: minmax(0, 1fr);
}

body.viewport-phone .video-preview-stage video {
  max-height: min(320px, 44dvh);
}

body.viewport-phone .video-preview-dialog-shell {
  place-items: start center;
  padding: 10px 12px max(76px, env(safe-area-inset-bottom));
}

body.viewport-phone .video-preview-dialog-card {
  width: min(100%, calc(100vw - 24px));
  max-height: calc(min(100svh, var(--visual-viewport-height, 100svh)) - 24px);
  border-radius: 8px;
  gap: 8px;
}

body.viewport-phone .video-preview-dialog-header {
  align-items: center;
}

body.viewport-phone .video-quality-menu {
  bottom: 52px;
  left: 10px;
  width: min(142px, calc(100% - 20px));
}

body.viewport-phone .video-camera-menu {
  bottom: 52px;
  left: 10px;
  width: min(220px, calc(100% - 20px));
}

body.device-ios .video-camera-button,
body.device-android .video-camera-button {
  min-width: 28px;
  width: 28px;
  padding: 0 6px;
}

body.device-ios .video-camera-button span,
body.device-android .video-camera-button span {
  display: none;
}

body.device-ios .video-camera-button::after,
body.device-android .video-camera-button::after {
  margin-left: 0;
}

body.viewport-phone .video-preview-dialog-card video {
  max-height: min(62svh, calc(min(100svh, var(--visual-viewport-height, 100svh)) - 190px));
}

body.viewport-phone .video-preview-dialog-actions {
  justify-content: flex-end;
  gap: 5px;
  padding-bottom: 0;
}

body.viewport-phone .video-preview-dialog-actions > button {
  width: 38px;
  min-width: 38px;
  height: 38px;
}

body.viewport-phone .message {
  max-width: calc(100% - 44px);
}

body.viewport-phone .message-body-wrap {
  max-width: 100%;
}

body.viewport-phone .message.with-avatar {
  grid-template-columns: 30px minmax(0, 1fr);
  column-gap: 8px;
  max-width: calc(100% - 56px);
  margin-left: 6px;
}

body.viewport-phone .message.with-avatar.self {
  grid-template-columns: minmax(0, 1fr) 30px;
  margin-left: auto;
  margin-right: 6px;
}

body.viewport-phone .message.with-avatar .message-avatar {
  width: 28px;
  height: 28px;
  margin-top: 18px;
  font-size: 11px;
}

body.viewport-phone .message.with-avatar.has-bubble-tail .message-avatar {
  margin-top: 4px;
}

body.viewport-phone .message-body {
  min-width: 0;
  font-size: 16px;
  line-height: 1.4;
}

body.viewport-phone .message.with-avatar:has(.call-message-card) .message-avatar {
  margin-top: 24px;
}

body.viewport-phone .message-body:has(.call-message-card) {
  width: 100%;
  padding: 8px;
}

body.viewport-phone .call-message-card {
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 8px;
  width: 100%;
}

body.viewport-phone .call-message-icon {
  width: 36px;
  height: 36px;
}

body.viewport-phone .call-message-text strong {
  font-size: 14px;
}

body.viewport-phone .call-message-text span {
  font-size: 12px;
}

body.viewport-phone .client-grid,
body.viewport-phone.conversation-open .client-grid,
body.viewport-phone.developer-mode.conversation-open .client-grid {
  --conversation-list-width: 0px;
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: minmax(0, 1fr);
}

body.viewport-phone .client-grid::before {
  inset: 0;
}

body.viewport-phone.conversation-open .conversation-list {
  display: none;
}

body.viewport-phone.conversation-open .chat-panel {
  grid-column: 1;
  width: 100%;
  max-width: 100vw;
}

body.viewport-phone .scroll-to-latest-button {
  right: 16px;
  bottom: 78px;
  width: 38px;
  min-width: 38px;
  height: 38px;
}

body.viewport-phone.call-active .chat-panel {
  overflow-x: hidden;
}

body.viewport-phone.call-active .call-panel,
body.viewport-phone.tc-text-full-active .call-panel {
  width: 100%;
  max-width: 100vw;
}

body.viewport-phone.call-active .tc-text-panel,
body.viewport-phone.call-active .call-panel.tc-text-full .tc-text-panel {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.viewport-phone.call-active .tc-text-line,
body.viewport-phone.call-active .call-panel.tc-text-full .tc-text-line {
  min-width: 0;
  overflow-wrap: anywhere;
}

body.viewport-phone.call-active .tc-text-line p,
body.viewport-phone.call-active .call-panel.tc-text-full .tc-text-line p {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.attachment-menu {
  position: relative;
  display: inline-flex;
}

.smiley-menu {
  position: relative;
  display: inline-flex;
}

.attachment-menu-panel {
  position: absolute;
  bottom: calc(100% + 10px);
  left: -4px;
  z-index: 50;
  display: grid;
  gap: 2px;
  width: 230px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .34);
  padding: 8px;
}

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

.smiley-picker-panel {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
  width: min(320px, calc(100vw - 28px));
  max-height: min(280px, 52vh);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .34);
  padding: 8px;
  transform: translateX(-50%);
}

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

.smiley-picker-panel.reaction-mode {
  position: fixed;
  bottom: auto;
  transform: none;
}

.smiley-picker-option {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 40px;
  border-color: transparent;
  border-radius: 8px;
  background: transparent;
  padding: 5px;
  text-align: center;
}

.smiley-picker-option:hover:not(:disabled) {
  background: rgba(79, 140, 255, .16);
}

.smiley-picker-option img {
  width: auto;
  max-width: 32px;
  height: 26px;
  object-fit: contain;
}

.attachment-menu-panel button {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 38px;
  border-color: transparent;
  border-radius: 8px;
  background: #eef5ff;
  color: #071526;
  text-align: left;
}

.attachment-menu-panel button:hover:not(:disabled) {
  background: #eef5ff;
}

.attachment-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: transparent;
}

.attachment-menu-panel button:hover:not(:disabled) .attachment-icon,
.attachment-menu-panel button:focus-visible .attachment-icon {
  background: currentColor;
}

.attachment-menu-panel button:hover:not(:disabled) .attachment-icon .material-icon,
.attachment-menu-panel button:focus-visible .attachment-icon .material-icon {
  color: #fff;
}

.attachment-icon .material-icon {
  width: 22px;
  height: 22px;
}

.attachment-document {
  color: #7c3aed;
}

.attachment-media {
  color: #0ea5e9;
}

.attachment-camera {
  color: #ec4899;
}

.attachment-video {
  color: #16a34a;
}

.attachment-audio {
  color: #f97316;
}

.attachment-contact {
  color: #0284c7;
}

.attachment-poll {
  color: #f59e0b;
}

.attachment-event {
  color: #e11d48;
}

.attachment-sticker {
  color: #10b981;
}

.attachment-location {
  color: #2563eb;
}

body[data-theme="dark"] .attachment-menu-panel {
  background: rgba(249, 251, 255, .97);
  border-color: rgba(76, 111, 166, .32);
}

body[data-theme="dark"] .attachment-menu-panel button {
  background: #eef5ff;
  color: #071526;
}

body[data-theme="dark"] .attachment-menu-panel button:hover:not(:disabled) {
  background: #eef5ff;
}

.send-row {
  margin-top: 6px;
  margin-bottom: 0;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.toggle input {
  width: auto;
}

.settings-section {
  display: grid;
  gap: 9px;
}

.settings-section label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}

.settings-section .button-row {
  align-items: stretch;
}

.settings-section .button-row button {
  flex: 1 1 0;
  min-width: 0;
}

.avatar-editor {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.avatar-editor-fields {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.avatar-editor input[type="color"] {
  width: 100%;
  height: 36px;
  padding: 3px;
}

.avatar-crop-card {
  width: min(520px, calc(100vw - 32px));
}

.avatar-crop-body {
  display: grid;
  gap: 12px;
}

.avatar-crop-stage {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(45deg, rgba(148, 163, 184, .18) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(148, 163, 184, .18) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(148, 163, 184, .18) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(148, 163, 184, .18) 75%),
    #e8eef7;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  background-size: 24px 24px;
  padding: 12px;
}

.avatar-crop-stage canvas {
  width: min(320px, calc(100vw - 96px));
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  cursor: grab;
  touch-action: none;
}

.avatar-crop-stage canvas.dragging {
  cursor: grabbing;
}

.avatar-crop-zoom {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.provider-summary {
  color: var(--muted);
  font-size: 13px;
}

.media-status {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #132034;
  color: #dbeafe;
  padding: 7px 9px;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.account-status {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #132034;
  color: #dbeafe;
  padding: 7px 9px;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.capability-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.capability {
  border: 1px solid #4b6f9e;
  border-radius: 6px;
  background: #132034;
  color: #dbeafe;
  padding: 4px 7px;
  font-size: 12px;
}

.settings-section.grow {
  min-height: 0;
  flex: 1;
}

.debug-log {
  min-height: 0;
  height: 100%;
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b1220;
  color: #d5e4f7;
  padding: 10px;
  white-space: pre-wrap;
  word-break: break-word;
}

.status-good {
  color: var(--good);
}

.status-warn {
  color: var(--warn);
}

.status-danger {
  color: var(--danger);
}

@media (max-width: 980px) {
  .app-shell {
    height: auto;
    min-height: 100vh;
  }

  .client-grid {
    --conversation-list-width: 0px;
    grid-template-columns: 1fr;
  }

  body.conversation-open .client-grid,
  body.developer-mode.conversation-open .client-grid {
    grid-template-columns: 1fr;
  }

  .conversation-list,
  .detail-panel {
    border: 0;
  }

  .conversation-list {
    order: 1;
    border-bottom: 1px solid #314159;
  }

  body.conversation-open .conversation-list {
    display: none;
  }

  .chat-panel {
    order: 2;
    min-height: 72vh;
  }

  body.conversation-open .back-to-contacts {
    display: inline-flex;
  }

  .detail-panel {
    order: 3;
    border-top: 1px solid #314159;
  }
}

@media (max-width: 520px) {
  body:not(.call-active):not(.account-gate):not(.account-booting) {
    min-height: 0;
    overflow: hidden;
  }

  body:not(.call-active):not(.account-gate):not(.account-booting) .app-shell {
    position: fixed;
    top: var(--visual-viewport-top, 0px);
    left: 0;
    right: 0;
    width: 100%;
  }

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

  body:not(.call-active) .app-shell {
    height: var(--visual-viewport-height, 100dvh);
    min-height: 0;
  }

  body:not(.call-active) .chat-panel {
    min-height: 0;
  }

  .topbar {
    padding-top: max(8px, env(safe-area-inset-top));
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }

  .top-actions {
    position: relative;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px;
  }

  .top-actions .top-icon-button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    flex: 0 0 44px;
  }

  .top-actions > button {
    min-height: 44px;
  }

  .top-actions .top-menu {
    position: static;
  }

  .top-actions .top-menu-panel {
    width: min(280px, 100%);
    min-width: 0;
  }

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

  .topbar,
  .chat-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .chat-header-actions,
  .call-controls,
  .top-actions,
  .mode-switch,
  .app-tabs {
    width: 100%;
  }

  .brand-logo {
    width: min(240px, 62vw);
    height: 40px;
  }

  .chat-header-actions {
    justify-items: stretch;
  }

  .call-status {
    flex: 1 1 100%;
    min-width: 0;
    text-align: left;
  }

  .call-mode-buttons {
    flex: 1 1 auto;
  }

  .call-controls .call-mode-button {
    flex: 0 0 38px;
  }

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

  .incoming-call-actions {
    width: 100%;
  }

  .incoming-call-actions button {
    flex: 1 1 0;
  }

  .call-menu,
  .call-menu-trigger {
    width: 100%;
  }

  .call-menu-panel {
    right: 0;
    left: 0;
  }

  .composer-tools .call-menu,
  .composer-tools .call-menu-trigger {
    width: auto;
  }

  .attachment-menu-panel {
    width: min(230px, calc(100vw - 28px));
  }

  .smiley-picker-panel {
    left: -42px;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    width: min(280px, calc(100vw - 28px));
    transform: none;
  }

  .call-media-controls {
    position: static;
    max-width: none;
    border-radius: 0;
    justify-content: space-between;
    flex-wrap: wrap;
    background: #0b1220;
  }

  .volume-control {
    flex: 1 1 180px;
  }

  .volume-control input {
    flex: 1 1 auto;
  }

  .top-actions button,
  .call-controls button,
  .mode-switch button {
    flex: 1 1 0;
    min-width: 0;
    padding-inline: 8px;
  }

  .account-settings-menu {
    display: none;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    grid-template-columns: none;
    overflow-x: auto;
    min-height: 0;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    margin: -4px 0 12px;
    padding: 0 0 10px;
    scrollbar-width: thin;
  }

  .account-menu-dialog .account-settings-menu {
    display: grid;
    position: static;
    max-height: none;
  }

  .account-menu-dialog .account-dialog-body {
    display: block;
    padding: 16px;
    background: var(--panel);
    overflow: auto;
  }

  .account-menu-dialog .account-settings-layout {
    display: block;
    min-height: 0;
    overflow: visible;
  }

  .account-menu-dialog .account-dialog-card {
    height: auto;
  }

  .account-settings-menu button {
    justify-content: center;
    min-width: 112px;
    white-space: nowrap;
    text-align: center;
  }

  body[data-theme] .account-settings-menu button,
  body[data-theme] .account-settings-menu button:hover:not(:disabled),
  body[data-theme] .account-settings-menu button.selected {
    justify-content: center;
    min-width: 112px;
    white-space: nowrap;
    text-align: center;
  }

  .account-menu-dialog .modal-section[data-settings-panel].active-settings-panel,
  .account-menu-dialog .account-advanced {
    grid-column: auto;
    min-height: 0;
    border-left: 0;
    background: transparent;
    padding: 0;
    overflow: visible;
  }

  .account-menu-dialog .dialog-status {
    margin: 0 0 12px;
  }

  .call-controls .call-mode-button {
    flex: 0 0 38px;
  }

  .message-timeline {
    padding: 12px;
  }

  .location-card-map {
    min-height: 150px;
  }

  body[data-chat-background="auto"] {
    --chat-background-image: url("assets/backgrounds/teletyptel-bg-mobile.png");
  }

  .account-dialog-grid {
    grid-template-columns: 1fr;
  }

  .password-fields-row,
  .password-rules-panel {
    grid-template-columns: 1fr;
  }

  .password-actions-row {
    align-items: stretch;
    flex-direction: column;
  }

  .password-actions-row button {
    width: 100%;
  }

  .two-factor-qr-panel {
    grid-template-columns: 1fr;
  }

  .two-factor-qr-code {
    justify-self: center;
  }

  .modal-actions {
    align-items: stretch;
    flex-direction: column;
  }

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

.chat-header .chat-more-toggle {
  display: none;
}

@media (max-width: 520px), (max-width: 1400px) and (pointer: coarse) {
  body.mobile-navigation-ready:not(.call-active) .topbar {
    position: relative;
    z-index: 60;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
  }

  body.mobile-navigation-ready:not(.call-active) .brand {
    flex: 1 1 auto;
    gap: 8px;
  }

  body.mobile-navigation-ready:not(.call-active) .brand-logo {
    flex: 0 1 160px;
    width: min(160px, 42vw);
    height: 34px;
  }

  body.mobile-navigation-ready:not(.call-active) .brand-status span {
    font-size: 10px;
    line-height: 1.25;
  }

  body.mobile-navigation-ready:not(.call-active) .mobile-actions-toggle {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    padding: 0;
  }

  body.mobile-navigation-ready:not(.call-active) .top-actions {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 12px;
    width: min(320px, calc(100vw - 24px));
    max-height: calc(100dvh - 85px);
    overflow: auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
    box-shadow: 0 12px 30px rgba(0, 0, 0, .2);
  }

  body.mobile-navigation-ready:not(.call-active) .mobile-actions-open .top-actions {
    display: grid;
  }

  body.mobile-navigation-ready .top-actions .top-icon-button {
    display: flex;
    position: relative;
    width: 100%;
    min-width: 0;
    height: 48px;
    margin: 0;
  }

  body.mobile-navigation-ready .top-actions .top-icon-button > svg,
  body.mobile-navigation-ready .top-actions .top-icon-button > .material-icon,
  body.mobile-navigation-ready .top-actions .top-icon-button > .contrast-symbol {
    width: 24px;
    height: 24px;
  }

  body.mobile-navigation-ready .top-actions .top-menu[open] {
    grid-column: 1 / -1;
  }

  body.mobile-navigation-ready .top-actions .top-menu-panel {
    position: static;
    width: 100%;
    margin-top: 6px;
    box-shadow: none;
  }

  body:not(.call-active) .chat-header {
    gap: 6px;
    padding: 8px 12px;
  }

  body:not(.call-active) .chat-title {
    gap: 8px;
    width: 100%;
  }

  body:not(.call-active) .chat-title h2 {
    font-size: 18px;
  }

  body:not(.call-active) .chat-title .avatar-header {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .back-to-contacts {
    align-items: center;
    justify-content: center;
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
  }

  body:not(.call-active) .call-mode-buttons {
    flex: 0 0 auto;
  }

  body:not(.call-active) .call-status {
    flex: 1 1 auto;
    min-width: 0;
    text-align: right;
  }

  body.compact-chat-header .chat-header {
    position: relative;
    min-width: 0;
    z-index: 30;
    align-items: center;
    flex-wrap: nowrap;
    gap: 4px;
    padding: 8px;
  }

  body.compact-chat-header .chat-title {
    flex: 1 1 auto;
    width: auto;
    gap: 4px;
  }

  body.compact-chat-header .chat-title > div:last-child {
    flex: 1 1 auto;
    overflow: hidden;
  }

  body.compact-chat-header .chat-title h2 {
    font-size: 16px;
  }

  body.compact-chat-header #activeConversationMeta {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
  }

  body.compact-chat-header .chat-title .avatar-header {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
  }

  body.compact-chat-header .chat-header-actions,
  body.compact-chat-header .call-controls,
  body.compact-chat-header .call-mode-buttons {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    width: auto;
    gap: 8px;
  }

  body.compact-chat-header .call-controls .call-mode-button,
  body.compact-chat-header .chat-header .chat-more-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
  }

  body.compact-chat-header .chat-header-actions {
    gap: 8px;
  }

  body.compact-chat-header #startTotalCallOption {
    flex-basis: 44px;
    width: 44px;
    border-color: #1559c4;
    border-radius: 14px;
    background: #1559c4;
    color: #ffffff;
    box-shadow: 0 3px 8px rgba(21, 89, 196, .2);
  }

  body.compact-chat-header #startTotalCallOption:hover:not(:disabled) {
    background: #10479e;
  }

  body.compact-chat-header #startTotalCallOption:disabled {
    border-color: #b6c9e5;
    background: #e3edfc;
    color: #4c6485;
    box-shadow: none;
  }

  body.compact-chat-header #startTotalCallOption .material-icon {
    width: 26px;
    height: 26px;
    color: inherit;
  }

  body.compact-chat-header #startTotalCallOption .material-icon-svg {
    color: inherit;
    fill: currentColor;
  }

  body.compact-chat-header .call-status {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .chat-more-panel {
    position: absolute;
    top: calc(100% + 4px);
    right: 8px;
    display: grid;
    gap: 6px;
    width: min(280px, calc(100vw - 16px));
    max-height: calc(100dvh - 150px);
    overflow: auto;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
    color: var(--text);
    box-shadow: 0 12px 30px rgba(0, 0, 0, .2);
  }

  .chat-more-panel .call-mode-button {
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    height: auto;
    padding: 10px;
    text-align: left;
  }

  .chat-more-panel .sr-only {
    position: static;
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    overflow: visible;
    clip: auto;
    clip-path: none;
    white-space: normal;
    color: inherit;
    font-size: 13px;
    line-height: 1.3;
  }

  .chat-more-status {
    padding: 4px 10px;
    color: var(--muted);
    font-size: 12px;
  }
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #eef2f7;
    --panel: #ffffff;
    --panel-strong: #edf3fb;
    --line: #c9d4e2;
    --text: #111827;
    --muted: #53657c;
    --bubble-self: #ddf8ea;
    --bubble-peer: #f5f7fb;
    --selection-bg: #dbeafe;
    --selection-border: #2563eb;
    --selection-text: #0f172a;
    --selection-muted: #eef6ff;
    --remote-draft-text: #102033;
  }

  body,
  .chat-panel {
    background-color: #eef2f7;
  }

  .topbar,
  .conversation-list,
  .detail-panel,
  .remote-draft,
  .app-tabs {
    background: #ffffff;
  }

  .composer {
    background: transparent;
  }

  .provider-card {
    background: #ffffff;
  }

  .capability {
    background: #edf4ff;
    color: #0f172a;
  }

  input,
  textarea,
  .debug-log,
  .smiley {
    background: #ffffff;
    color: #111827;
  }

  button {
    background: #edf4ff;
    color: #0f172a;
  }
}

body[data-theme="light"] {
  --bg: #eef2f7;
  --panel: #ffffff;
  --panel-strong: #edf3fb;
  --line: #c9d4e2;
  --text: #111827;
  --muted: #53657c;
  --bubble-self: #ddf8ea;
  --bubble-peer: #f5f7fb;
  --selection-bg: #dbeafe;
  --selection-border: #2563eb;
  --selection-text: #0f172a;
  --selection-muted: #eef6ff;
  --remote-draft-text: #102033;
  --chat-background-overlay: rgba(255, 255, 255, .34);
  color-scheme: light;
}

body[data-theme="light"],
body[data-theme="light"] .chat-panel {
  background-color: #eef2f7;
}

body[data-theme="light"] .topbar,
body[data-theme="light"] .conversation-list,
body[data-theme="light"] .detail-panel,
body[data-theme="light"] .remote-draft {
  background: #ffffff;
}

body[data-theme="light"] .app-tabs {
  background: rgba(255, 255, 255, .72);
}

body[data-theme="light"] .chat-header {
  background: rgba(255, 255, 255, .68);
}

body[data-theme="light"] .composer {
  background: transparent;
}

body[data-theme="light"] .drop-overlay {
  background: rgba(238, 242, 247, .88);
  color: #0f172a;
}

body[data-theme="light"] .drop-overlay div {
  background: #ffffff;
}

body[data-theme="light"] .drop-overlay span {
  color: #334155;
}

body[data-theme="light"] .provider-card {
  background: #ffffff;
}

body[data-theme="light"] .blocked-contact-row,
body[data-theme="light"] .archive-contact-row {
  background: #f5f8fc;
}

body[data-theme="light"] .location-panel {
  background: #f5f8fc;
}

body[data-theme="light"] .location-warnings span {
  color: #7c4a03;
}

body[data-theme="light"] .location-card {
  background: #ecfdf5;
}

body[data-theme="light"] .announcement-item {
  background: #f5f8fc;
}

body[data-theme="light"] .announcement-item a {
  color: #0b55c7;
}

body[data-theme="light"] .checklist li {
  background: #f5f8fc;
}

body[data-theme="light"] .capability {
  background: #edf4ff;
  color: #0f172a;
}

body[data-theme="light"] .account-status {
  background: #f5f8fc;
  color: #334155;
}

body[data-theme="light"] .media-status {
  background: #f5f8fc;
  color: #334155;
}

body[data-theme="light"] .modal-card {
  background: #ffffff;
}

body[data-theme="light"] .modal-header,
body[data-theme="light"] .modal-actions {
  background: #edf3fb;
}

body[data-theme="light"] .dialog-status {
  background: #f5f8fc;
  color: #334155;
}

body[data-theme="light"] input,
body[data-theme="light"] select,
body[data-theme="light"] textarea,
body[data-theme="light"] .debug-log,
body[data-theme="light"] .smiley {
  background: #ffffff;
  color: #111827;
}

body[data-theme="light"] button {
  background: #edf4ff;
  color: #0f172a;
}

body[data-theme="light"] .top-menu summary {
  background: #edf4ff;
  color: #0f172a;
}

body[data-theme="light"] .top-menu-panel {
  background: #ffffff;
}

body[data-theme="light"] .context-menu {
  background: #ffffff;
}

body[data-theme="light"] .context-menu .danger-action:not(:disabled) {
  color: #991b1b;
}

body[data-theme="light"] button:hover:not(:disabled):not(.social-login-button):not(.google-sdk-login-overlay),
body[data-theme="light"] button.selected:not(.social-login-button):not(.google-sdk-login-overlay),
body[data-theme="light"] .top-menu[open] summary,
body[data-theme="light"] .top-menu summary:hover {
  background: var(--accent-strong);
  color: #ffffff;
}

body[data-theme="light"] .icon-button.call-mode-button,
body[data-theme="light"] .icon-button.call-media-icon-button,
body[data-theme="light"] .icon-button.disconnect-icon-button {
  border-color: #6aa2ff;
  background: rgba(237, 244, 255, .92);
  color: #174a8b;
}

body[data-theme="light"] .icon-button.call-mode-button:disabled,
body[data-theme="light"] .icon-button.call-media-icon-button:disabled,
body[data-theme="dark"] .icon-button.call-mode-button:disabled,
body[data-theme="dark"] .icon-button.call-media-icon-button:disabled {
  border-color: #b6d1fb;
  background: rgba(237, 244, 255, .82);
  color: #526d8f;
  opacity: 1;
}

body[data-theme="light"] .icon-button.call-mode-button:hover:not(:disabled),
body[data-theme="light"] .icon-button.call-media-icon-button:hover:not(:disabled) {
  background: #dbeafe;
  color: #0f3f7c;
}

body[data-theme="dark"] {
  --bg: #111827;
  --panel: #1f2937;
  --panel-strong: #263244;
  --line: #4b5563;
  --text: #f9fafb;
  --muted: #b6c2d1;
  --bubble-self: #144f3a;
  --bubble-peer: #273242;
  --selection-bg: #213858;
  --selection-border: #6aa2ff;
  --selection-text: #ffffff;
  --selection-muted: #b6c2d1;
  --remote-draft-text: #dbeafe;
  --chat-background-overlay: rgba(5, 12, 24, .66);
  color-scheme: dark;
}

body[data-theme="dark"],
body[data-theme="dark"] .chat-panel {
  background-color: #0f1724;
}

body[data-theme="dark"] .topbar,
body[data-theme="dark"] .conversation-list,
body[data-theme="dark"] .detail-panel,
body[data-theme="dark"] .remote-draft,
body[data-theme="dark"] .app-tabs {
  background: #151f2d;
}

body[data-theme="dark"] .app-tabs {
  background: rgba(17, 27, 42, .78);
}

body[data-theme="dark"] .chat-header {
  background: rgba(21, 31, 45, .72);
}

body[data-theme="dark"] .voice-preview-panel {
  background: rgba(255, 255, 255, .96);
  color: #071526;
}

body[data-theme="dark"] .voice-preview-meta {
  color: #0b3b78;
}

body[data-theme="dark"] .remote-draft {
  background: #18253a;
}

body[data-theme="dark"] .provider-card {
  background: #1a2637;
}

body[data-theme="dark"] .blocked-contact-row,
body[data-theme="dark"] .archive-contact-row {
  background: #132034;
}

body[data-theme="dark"] .location-panel {
  background: rgba(19, 32, 52, .72);
}

body[data-theme="dark"] .announcement-item {
  background: rgba(19, 32, 52, .72);
}

body[data-theme="dark"] .checklist li {
  background: rgba(19, 32, 52, .72);
}

body[data-theme="dark"] .capability {
  background: #132034;
  color: #dbeafe;
}

body[data-theme="dark"] .account-status {
  background: #132034;
  color: #dbeafe;
}

body[data-theme="dark"] .media-status {
  background: #132034;
  color: #dbeafe;
}

body[data-theme="dark"] .modal-card {
  background: #151f2d;
}

body[data-theme="dark"] .modal-header,
body[data-theme="dark"] .modal-actions {
  background: #1f2937;
}

body[data-theme="dark"] .dialog-status {
  background: #132034;
  color: #dbeafe;
}

body[data-theme="dark"] input,
body[data-theme="dark"] select,
body[data-theme="dark"] textarea {
  background: #101820;
  color: var(--text);
}

body[data-theme="dark"] .composer-input-row {
  border-color: transparent;
  background: #0f1724;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .36), 0 1px 2px rgba(0, 0, 0, .24);
}

body[data-theme="dark"] .composer-input-row:focus-within {
  border-color: transparent;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .42), 0 1px 2px rgba(0, 0, 0, .28);
}

body[data-theme="dark"] .scroll-to-latest-button {
  border-color: rgba(148, 163, 184, .36);
  background: rgba(15, 23, 36, .94);
  color: #dbeafe;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .48), 0 2px 6px rgba(0, 0, 0, .32), inset 0 1px 0 rgba(255, 255, 255, .08);
}

body[data-theme="dark"] .scroll-to-latest-button:hover:not(:disabled),
body[data-theme="dark"] .scroll-to-latest-button:focus-visible {
  background: rgba(30, 41, 59, .98);
  color: #93c5fd;
}

body[data-theme="dark"] .scroll-to-latest-symbol {
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .55));
}

body[data-theme="dark"] .composer-round-button,
body[data-theme="dark"] .composer-send-button {
  background: #1f2d43;
  color: #e5eefb;
}

body[data-theme="dark"] .composer-round-button:hover:not(:disabled),
body[data-theme="dark"] .composer-send-button:hover:not(:disabled) {
  background: #2a3a52;
}

body[data-theme="dark"] .debug-log,
body[data-theme="dark"] .smiley {
  background: #0b1220;
  color: #d5e4f7;
}

body[data-theme="dark"] button {
  background: #16243a;
  color: var(--text);
}

body[data-theme="dark"] .top-menu summary {
  background: #16243a;
  color: var(--text);
}

body[data-theme="dark"] .top-menu-panel {
  background: #151f2d;
}

body[data-theme="dark"] .context-menu {
  background: #151f2d;
}

body[data-theme="dark"] button:hover:not(:disabled):not(.social-login-button):not(.google-sdk-login-overlay),
body[data-theme="dark"] button.selected:not(.social-login-button):not(.google-sdk-login-overlay),
body[data-theme="dark"] .top-menu[open] summary,
body[data-theme="dark"] .top-menu summary:hover {
  background: var(--accent-strong);
  color: #ffffff;
}

body[data-theme="dark"] .icon-button.call-mode-button,
body[data-theme="dark"] .icon-button.call-media-icon-button,
body[data-theme="dark"] .icon-button.disconnect-icon-button {
  border-color: #6aa2ff;
  background: #edf4ff;
  color: #174a8b;
}

body[data-theme="dark"] .icon-button.call-mode-button:hover:not(:disabled),
body[data-theme="dark"] .icon-button.call-media-icon-button:hover:not(:disabled) {
  background: #dbeafe;
  color: #0f3f7c;
}

body[data-theme] .disconnect-icon-button,
body[data-theme] .hangup-icon-button {
  border-color: #ef4444 !important;
  background: #dc2626 !important;
  color: #ffffff !important;
}

body[data-theme] .disconnect-icon-button:not(:disabled),
body[data-theme] .hangup-icon-button:not(:disabled) {
  box-shadow: inset 0 -2px 0 rgba(220, 38, 38, .7);
}

body[data-theme] .disconnect-icon-button:hover:not(:disabled),
body[data-theme] .hangup-icon-button:hover:not(:disabled) {
  background: #b91c1c !important;
  color: #ffffff !important;
}

body[data-theme] .call-media-icon-button.selected {
  border-color: #ef4444 !important;
  background: #dc2626 !important;
  color: #ffffff !important;
}

body[data-theme] .call-media-icon-button:disabled {
  border-color: #7f1d1d !important;
  background: #991b1b !important;
  color: #ffffff !important;
  opacity: 1;
}

body[data-theme] .account-settings-menu button,
body[data-theme] .account-settings-menu button:hover:not(:disabled),
body[data-theme] .account-settings-menu button.selected {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 40px;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  padding: 8px 10px;
  text-align: left;
}

body[data-theme] .account-settings-menu button:hover:not(:disabled),
body[data-theme] .account-settings-menu button:focus-visible {
  background: rgba(37, 99, 235, .08);
  color: var(--accent);
}

body[data-theme] .account-settings-menu button.selected {
  border-left-color: var(--accent);
  color: var(--accent);
}

body[data-theme="dark"] .tab-panel.history-panel,
body[data-theme="dark"] .history-card.provider-card,
body[data-theme="dark"] .history-settings,
body[data-theme="dark"] .history-list,
body[data-theme="dark"] .history-detail {
  background: #f8fbff;
  color: #0f172a;
}

body[data-theme="dark"] .history-card.provider-card,
body[data-theme="dark"] .history-settings,
body[data-theme="dark"] .history-list,
body[data-theme="dark"] .history-detail,
body[data-theme="dark"] .history-item,
body[data-theme="dark"] .history-transcript-line {
  border-color: #bfd7ff;
}

body[data-theme="dark"] .history-toggle,
body[data-theme="dark"] .history-retention,
body[data-theme="dark"] .history-detail h3,
body[data-theme="dark"] .history-transcript-line strong,
body[data-theme="dark"] .history-message-text,
body[data-theme="dark"] .history-transcript-line p {
  color: #0f172a;
}

body[data-theme="dark"] .history-item {
  background: #eef5ff;
  color: #0f172a;
}

body[data-theme="dark"] .history-item.selected {
  border-color: #1d4ed8;
  background: #2563eb;
  color: #ffffff;
}

body[data-theme="dark"] .history-item.selected .history-item-title,
body[data-theme="dark"] .history-item.selected .history-item-meta,
body[data-theme="dark"] .history-item.selected .history-item-preview {
  color: #ffffff;
}

body[data-theme="dark"] .history-item-meta,
body[data-theme="dark"] .history-item-preview,
body[data-theme="dark"] .history-detail-meta,
body[data-theme="dark"] .history-empty,
body[data-theme="dark"] .history-group {
  color: #475569;
}

@media (max-width: 720px) {
  body.call-active .app-shell {
    grid-template-rows: auto minmax(0, 1fr);
  }

  body.tc-text-visible-active.call-active .app-shell {
    grid-template-rows: minmax(0, 1fr);
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  body.tc-text-visible-active.call-active .client-grid,
  body.tc-text-visible-active.call-active .chat-panel {
    min-height: 0;
  }

  body.tc-text-visible-active.call-active .chat-panel {
    overflow: auto;
  }

  body.call-active .topbar {
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 6px 10px;
  }

  body.tc-text-visible-active.call-active .topbar {
    display: none;
  }

  body.call-active .brand {
    gap: 8px;
  }

  body.call-active .brand-logo {
    width: min(176px, 48vw);
    height: 30px;
  }

  body.call-active .brand-status {
    font-size: 11px;
    line-height: 1.15;
  }

  body.call-active .brand-status span {
    font-size: 11px;
  }

  body.call-active .top-actions {
    display: none;
  }

  body.call-active .app-tabs {
    display: none;
  }

  body.call-active .chat-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
  }

  body.call-active .back-to-contacts {
    display: none;
  }

  body.call-active .avatar-header {
    width: 30px;
    height: 30px;
    font-size: 12px;
  }

  body.call-active .chat-title {
    flex: 0 0 auto;
    gap: 8px;
  }

  body.call-active .chat-title > div:last-child {
    display: none;
  }

  body.call-active .chat-header-actions {
    flex: 1 1 auto;
    min-width: 0;
    gap: 4px;
  }

  body.call-active .call-controls {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    align-items: center;
    justify-content: start;
    gap: 6px;
    width: 100%;
  }

  body.call-active .call-status {
    grid-column: auto;
    font-size: 11px;
    line-height: 1.2;
    text-align: left;
  }

  body.call-active .call-panel,
  body.tc-text-full-active .call-panel {
    display: grid;
    grid-row: 4;
    grid-template-rows: minmax(180px, 36vh) auto auto;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
  }

  body.call-active .call-panel.local-video-main {
    height: auto;
    max-height: none;
  }

  body.tc-text-visible-active.call-active .call-panel {
    grid-template-rows: minmax(220px, 46dvh) auto auto;
  }

  .call-panel video,
  body.call-active .call-panel video,
  .call-panel.local-video-main #localVideo {
    grid-row: 1;
    width: 100%;
    height: 100%;
    min-height: 0;
    aspect-ratio: auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    object-fit: contain;
  }

  .call-panel.local-video-main #localVideo {
    position: static;
  }

  .call-panel:not(.local-video-main) #localVideo {
    position: absolute;
    top: 10px;
    right: 10px;
    bottom: auto;
    z-index: 4;
    width: min(132px, 34vw);
    height: auto;
    aspect-ratio: 16 / 9;
    border: 1px solid #6aa2ff;
    border-radius: var(--radius);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .34);
  }

  .call-panel.tc-text-full video {
    display: block;
  }

  .tc-text-panel,
  .call-panel.tc-text-full .tc-text-panel {
    position: static;
    grid-row: 2;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto;
    gap: 8px;
    padding: 8px;
    pointer-events: auto;
  }

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

  .tc-text-line,
  .call-panel.tc-text-full .tc-text-line {
    min-height: 82px;
    max-height: 128px;
    overflow: auto;
    padding: 8px 10px;
  }

  .tc-text-line span,
  .call-panel.tc-text-full .tc-text-line span {
    font-size: 12px;
  }

  .tc-text-line p,
  .call-panel.tc-text-full .tc-text-line p {
    min-height: 18px;
    font-size: 15px;
    line-height: 1.28;
  }

  .tc-text-lines p:first-child,
  .call-panel.tc-text-full .tc-text-lines p:first-child {
    font-size: 13px;
  }

  .call-media-controls {
    position: static;
    grid-row: 3;
    z-index: auto;
    gap: 8px;
    max-width: none;
    padding: 8px;
  }

  body.tc-text-visible-active .message-timeline {
    display: none;
  }

  body.tc-text-visible-active .remote-draft {
    display: none;
  }

  body.tc-text-visible-active .composer {
    grid-row: 5;
  }
}

@media (max-width: 430px) {
  body.call-active .call-panel,
  body.tc-text-full-active .call-panel {
    grid-template-rows: minmax(150px, 30vh) auto auto;
  }

  .tc-text-panel,
  .call-panel.tc-text-full .tc-text-panel {
    gap: 6px;
    padding: 6px;
  }

  .tc-text-line,
  .call-panel.tc-text-full .tc-text-line {
    min-height: 74px;
    max-height: 112px;
    padding: 7px 8px;
  }

  .tc-text-line p,
  .call-panel.tc-text-full .tc-text-line p {
    font-size: 14px;
  }

  .volume-control {
    flex-basis: 100%;
  }
}

@media (max-width: 940px) and (orientation: landscape) {
  body.call-active .app-shell {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  body.tc-text-visible-active.call-active .app-shell {
    grid-template-rows: minmax(0, 1fr);
  }

  body.call-active .client-grid,
  body.call-active .chat-panel {
    min-height: 0;
  }

  body.call-active .chat-panel {
    overflow: auto;
  }

  body.tc-text-visible-active.call-active .topbar,
  body.call-active .app-tabs,
  body.call-active .back-to-contacts {
    display: none;
  }

  body.call-active .topbar {
    padding-block: 4px;
  }

  body.call-active .brand-logo {
    width: min(150px, 32vw);
    height: 26px;
  }

  body.call-active .brand-status,
  body.call-active .brand-status span {
    font-size: 10px;
  }

  body.call-active .chat-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-block: 4px;
    padding-inline: 10px;
  }

  body.call-active .avatar-header {
    width: 28px;
    height: 28px;
  }

  body.call-active .chat-title {
    flex: 0 0 auto;
    gap: 8px;
  }

  body.call-active .chat-title > div:last-child {
    display: none;
  }

  body.call-active .chat-header-actions {
    flex: 1 1 auto;
    min-width: 0;
  }

  body.call-active .call-controls {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    align-items: center;
    justify-content: start;
    width: 100%;
  }

  body.call-active .call-mode-button {
    min-width: 34px;
    width: 34px;
    height: 30px;
  }

  body.call-active .call-status {
    font-size: 10px;
    text-align: left;
  }

  body.call-active .call-panel,
  body.tc-text-full-active .call-panel {
    grid-template-rows: minmax(112px, 36dvh) auto auto;
    height: auto;
    max-height: none;
  }

  body.call-active .call-panel.local-video-main {
    height: auto;
    max-height: none;
  }

  body.tc-text-visible-active.call-active .call-panel {
    grid-template-rows: minmax(124px, 42dvh) auto auto;
  }

  body.call-active .call-panel:not(.local-video-main) #localVideo {
    width: min(120px, 22vw);
  }

  body.call-active .tc-text-panel,
  body.call-active .call-panel.tc-text-full .tc-text-panel {
    gap: 6px;
    padding: 6px;
  }

  body.call-active .tc-text-line,
  body.call-active .call-panel.tc-text-full .tc-text-line {
    min-height: 56px;
    max-height: 84px;
    padding: 6px 8px;
  }

  body.call-active .tc-text-line p,
  body.call-active .call-panel.tc-text-full .tc-text-line p {
    min-height: 16px;
    font-size: 13px;
    line-height: 1.2;
  }

  body.call-active .call-media-controls {
    padding: 6px;
  }

  body.call-active .call-media-icon-button {
    width: 34px;
    height: 32px;
  }

  body.call-active .call-device-controls {
    flex: 1 1 100%;
    order: 2;
  }

  body.call-active .call-device-select {
    flex: 1 1 min(180px, 40vw);
  }

  body.call-active .call-device-select select {
    width: 100%;
  }

  body.call-active .volume-control {
    order: 3;
    flex-basis: min(320px, 42vw);
    font-size: 12px;
  }

  body.tc-text-visible-active .composer {
    padding: 6px 10px;
  }

  body.tc-text-visible-active .send-row {
    display: none;
  }

  body.tc-text-visible-active .composer-input-row textarea {
    min-height: 30px;
    max-height: 60px;
    padding-block: 5px;
  }

  body.tc-text-visible-active .composer-round-button,
  body.tc-text-visible-active .composer-send-button {
    width: 32px;
    min-width: 32px;
    height: 32px;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  body.tc-text-visible-active.call-active {
    overflow: hidden;
  }

  body.tc-text-visible-active.call-active .app-shell {
    grid-template-rows: minmax(0, 1fr);
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  body.tc-text-visible-active.call-active .client-grid,
  body.tc-text-visible-active.call-active .chat-panel {
    min-height: 0;
  }

  body.tc-text-visible-active.call-active .chat-panel {
    overflow: auto;
  }

  body.tc-text-visible-active.call-active .topbar,
  body.tc-text-visible-active.call-active .app-tabs,
  body.tc-text-visible-active.call-active .back-to-contacts,
  body.tc-text-visible-active.call-active .message-timeline,
  body.tc-text-visible-active.call-active .remote-draft {
    display: none;
  }

  body.tc-text-visible-active.call-active .chat-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
  }

  body.tc-text-visible-active.call-active .avatar-header {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  body.tc-text-visible-active.call-active .chat-title {
    flex: 0 0 auto;
    gap: 8px;
  }

  body.tc-text-visible-active.call-active .chat-title > div:last-child {
    display: none;
  }

  body.tc-text-visible-active.call-active .chat-header-actions {
    flex: 1 1 auto;
    min-width: 0;
  }

  body.tc-text-visible-active.call-active .call-controls {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    align-items: center;
    justify-content: start;
    gap: 6px;
    width: 100%;
  }

  body.tc-text-visible-active.call-active .call-mode-button {
    min-width: 34px;
    width: 34px;
    height: 30px;
  }

  body.tc-text-visible-active.call-active .call-status {
    min-width: 0;
    font-size: 10px;
    line-height: 1.15;
    text-align: left;
  }

  body.tc-text-visible-active.call-active .call-panel {
    display: grid;
    grid-row: 4;
    grid-template-rows: minmax(110px, 40dvh) auto auto;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
  }

  body.tc-text-visible-active.call-active .call-panel.local-video-main {
    height: auto;
    max-height: none;
  }

  body.tc-text-visible-active.call-active .call-panel video,
  body.tc-text-visible-active.call-active .call-panel.local-video-main #localVideo {
    grid-row: 1;
    width: 100%;
    height: 100%;
    min-height: 0;
    object-fit: contain;
  }

  body.tc-text-visible-active.call-active .call-panel:not(.local-video-main) #localVideo {
    top: 8px;
    right: 8px;
    width: min(116px, 22vw);
  }

  body.tc-text-visible-active.call-active .tc-text-panel,
  body.tc-text-visible-active.call-active .call-panel.tc-text-full .tc-text-panel {
    position: static;
    grid-row: 2;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 6px;
  }

  body.tc-text-visible-active.call-active .tc-text-line,
  body.tc-text-visible-active.call-active .call-panel.tc-text-full .tc-text-line {
    min-height: 54px;
    max-height: 78px;
    padding: 6px 8px;
  }

  body.tc-text-visible-active.call-active .tc-text-line span,
  body.tc-text-visible-active.call-active .call-panel.tc-text-full .tc-text-line span {
    font-size: 11px;
  }

  body.tc-text-visible-active.call-active .tc-text-line p,
  body.tc-text-visible-active.call-active .call-panel.tc-text-full .tc-text-line p {
    min-height: 15px;
    font-size: 13px;
    line-height: 1.18;
  }

  body.tc-text-visible-active.call-active .call-media-controls {
    position: static;
    grid-row: 3;
    gap: 6px;
    max-width: none;
    padding: 6px;
  }

  body.tc-text-visible-active.call-active .call-media-icon-button {
    width: 34px;
    height: 32px;
  }

  body.tc-text-visible-active.call-active .volume-control {
    flex: 1 1 min(300px, 44vw);
    font-size: 12px;
  }

  body.tc-text-visible-active.call-active .composer {
    grid-row: 5;
    padding: 6px 10px;
  }

  body.tc-text-visible-active.call-active .send-row {
    display: none;
  }

  body.tc-text-visible-active.call-active .composer-input-row {
    gap: 6px;
    padding: 4px 7px;
  }

  body.tc-text-visible-active.call-active .composer-input-row textarea {
    min-height: 30px;
    max-height: 54px;
    padding-block: 5px;
  }

  body.tc-text-visible-active.call-active .composer-round-button,
  body.tc-text-visible-active.call-active .composer-send-button {
    width: 32px;
    min-width: 32px;
    height: 32px;
  }
}

body.tc-phone-landscape-active {
  overflow: hidden;
}

body.tc-phone-landscape-active .app-shell {
  grid-template-rows: minmax(0, 1fr);
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

body.tc-phone-landscape-active .client-grid,
body.tc-phone-landscape-active .chat-panel {
  min-height: 0;
}

body.tc-phone-landscape-active .chat-panel {
  overflow: auto;
}

body.tc-phone-landscape-active .topbar,
body.tc-phone-landscape-active .app-tabs,
body.tc-phone-landscape-active .back-to-contacts,
body.tc-phone-landscape-active .message-timeline,
body.tc-phone-landscape-active .remote-draft {
  display: none;
}

body.tc-phone-landscape-active .chat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
}

body.tc-phone-landscape-active .avatar-header {
  width: 28px;
  height: 28px;
  font-size: 12px;
}

body.tc-phone-landscape-active .chat-title {
  flex: 0 0 auto;
  gap: 8px;
}

body.tc-phone-landscape-active .chat-title > div:last-child {
  display: none;
}

body.tc-phone-landscape-active .chat-header-actions {
  flex: 1 1 auto;
  min-width: 0;
}

body.tc-phone-landscape-active .call-controls {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  justify-content: start;
  gap: 6px;
  width: 100%;
}

body.tc-phone-landscape-active .call-mode-button {
  min-width: 34px;
  width: 34px;
  height: 30px;
}

body.tc-phone-landscape-active .call-status {
  min-width: 0;
  font-size: 10px;
  line-height: 1.15;
  text-align: left;
}

body.viewport-phone.tc-phone-landscape-active.call-active .call-panel,
body.viewport-phone.tc-phone-landscape-active.call-active .call-panel.local-video-main {
  display: grid;
  grid-row: 4;
  grid-template-rows: minmax(110px, 40dvh) auto auto;
  height: auto;
  min-height: 0;
  max-height: none;
  overflow: visible;
}

body.tc-phone-landscape-active .call-panel.local-video-main {
  height: auto;
  max-height: none;
}

body.tc-phone-landscape-active .call-panel video,
body.tc-phone-landscape-active .call-panel.local-video-main #localVideo {
  grid-row: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

body.viewport-phone.tc-phone-landscape-active .call-panel:not(.local-video-main) #localVideo {
  top: 8px;
  right: 8px;
  width: min(116px, 22vw) !important;
  height: auto !important;
  aspect-ratio: 16 / 9;
}

body.tc-phone-landscape-active .tc-text-panel,
body.tc-phone-landscape-active .call-panel.tc-text-full .tc-text-panel {
  position: static;
  grid-row: 2;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
}

body.tc-phone-landscape-active .tc-text-line,
body.tc-phone-landscape-active .call-panel.tc-text-full .tc-text-line {
  min-height: 54px;
  max-height: 78px;
  padding: 6px 8px;
}

body.tc-phone-landscape-active .tc-text-line span,
body.tc-phone-landscape-active .call-panel.tc-text-full .tc-text-line span {
  font-size: 11px;
}

body.tc-phone-landscape-active .tc-text-line p,
body.tc-phone-landscape-active .call-panel.tc-text-full .tc-text-line p {
  min-height: 15px;
  font-size: 13px;
  line-height: 1.18;
}

body.tc-phone-landscape-active .call-media-controls {
  position: static;
  grid-row: 3;
  gap: 6px;
  max-width: none;
  padding: 6px;
}

body.tc-phone-landscape-active .call-media-icon-button {
  width: 34px;
  height: 32px;
}

body.tc-phone-landscape-active .call-device-controls {
  display: none;
}

body.tc-phone-landscape-active .volume-control {
  flex: 1 1 min(300px, 44vw);
  font-size: 12px;
}

body.tc-phone-landscape-active .composer {
  grid-row: 5;
  padding: 6px 10px;
}

body.tc-phone-landscape-active .send-row {
  display: none;
}

body.tc-phone-landscape-active .composer-input-row {
  gap: 6px;
  padding: 4px 7px;
}

body.tc-phone-landscape-active .composer-input-row textarea {
  min-height: 30px;
  max-height: 54px;
  padding-block: 5px;
}

body.tc-phone-landscape-active .composer-round-button,
body.tc-phone-landscape-active .composer-send-button {
  width: 32px;
  min-width: 32px;
  height: 32px;
}

body.tc-phone-keyboard-active .chat-header {
  padding-block: 2px;
}

body.tc-phone-keyboard-active .avatar-header {
  width: 24px;
  height: 24px;
  font-size: 10px;
}

body.tc-phone-keyboard-active .call-mode-button {
  min-width: 30px;
  width: 30px;
  height: 28px;
}

body.tc-phone-keyboard-active .call-status {
  font-size: 9px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.viewport-phone.tc-phone-landscape-active.tc-phone-keyboard-active.call-active .call-panel,
body.viewport-phone.tc-phone-landscape-active.tc-phone-keyboard-active.call-active .call-panel.local-video-main {
  grid-template-rows: minmax(70px, 24dvh) auto auto;
}

body.tc-phone-keyboard-active .call-panel:not(.local-video-main) #localVideo {
  width: min(92px, 18vw);
}

body.tc-phone-keyboard-active .tc-text-panel,
body.tc-phone-keyboard-active .call-panel.tc-text-full .tc-text-panel {
  gap: 4px;
  padding: 4px;
}

body.tc-phone-keyboard-active .tc-text-line,
body.tc-phone-keyboard-active .call-panel.tc-text-full .tc-text-line {
  min-height: 44px;
  max-height: 58px;
  padding: 4px 6px;
}

body.tc-phone-keyboard-active .tc-text-line span,
body.tc-phone-keyboard-active .call-panel.tc-text-full .tc-text-line span {
  font-size: 10px;
}

body.tc-phone-keyboard-active .tc-text-line p,
body.tc-phone-keyboard-active .call-panel.tc-text-full .tc-text-line p {
  min-height: 13px;
  font-size: 12px;
  line-height: 1.12;
}

body.tc-phone-keyboard-active .call-media-controls {
  gap: 4px;
  padding: 4px;
}

body.tc-phone-keyboard-active .call-media-icon-button {
  width: 30px;
  height: 30px;
}

body.tc-phone-keyboard-active .call-device-controls {
  display: none;
}

body.tc-phone-keyboard-active .volume-control {
  flex-basis: min(240px, 38vw);
  font-size: 11px;
}

body.tc-phone-keyboard-active .volume-control input {
  width: 90px;
}

body.tc-phone-keyboard-active .composer {
  padding: 4px 8px;
}

body.tc-phone-keyboard-active .composer-input-row {
  gap: 4px;
  padding: 3px 6px;
}

body.tc-phone-keyboard-active .composer-input-row textarea {
  min-height: 26px;
  max-height: 38px;
  padding-block: 3px;
}

body.tc-phone-keyboard-active .composer-round-button,
body.tc-phone-keyboard-active .composer-send-button {
  width: 28px;
  min-width: 28px;
  height: 28px;
}

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

body.viewport-phone .client-grid,
body.viewport-phone.conversation-open .client-grid,
body.viewport-phone.developer-mode.conversation-open .client-grid {
  --conversation-list-width: 0px !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: minmax(0, 1fr) !important;
  width: 100% !important;
  max-width: 100vw !important;
  overflow-x: hidden !important;
}

body.viewport-phone .client-grid::before {
  inset: 0 !important;
}

body.viewport-phone.conversation-open .conversation-list {
  display: none !important;
}

body.viewport-phone.conversation-open .chat-panel {
  grid-column: 1 !important;
  width: 100% !important;
  max-width: 100vw !important;
  overflow-x: hidden !important;
}

body.viewport-phone.call-active .call-panel,
body.viewport-phone.tc-text-full-active .call-panel,
body.viewport-phone.tc-text-visible-active.call-active .call-panel,
body.viewport-phone.tc-phone-landscape-active .call-panel {
  grid-column: 1 !important;
  width: 100% !important;
  max-width: 100vw !important;
  min-width: 0 !important;
  overflow: visible !important;
}

body.viewport-phone.viewport-portrait.call-active .call-panel,
body.viewport-phone.viewport-portrait.tc-text-full-active .call-panel,
body.viewport-phone.viewport-portrait.tc-text-visible-active.call-active .call-panel {
  grid-template-rows: minmax(220px, 42dvh) auto auto !important;
}

body.viewport-phone.call-active .call-panel video,
body.viewport-phone.call-active .call-panel.local-video-main #localVideo {
  width: 100% !important;
  max-width: 100vw !important;
}

body.viewport-phone.call-active .tc-text-panel,
body.viewport-phone.call-active .call-panel.tc-text-full .tc-text-panel,
body.viewport-phone.tc-text-visible-active.call-active .tc-text-panel,
body.viewport-phone.tc-text-visible-active.call-active .call-panel.tc-text-full .tc-text-panel {
  position: static !important;
  grid-row: 2 !important;
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 6px !important;
  padding: 6px !important;
  width: 100% !important;
  max-width: 100vw !important;
}

body.viewport-phone.call-active .tc-text-line,
body.viewport-phone.call-active .call-panel.tc-text-full .tc-text-line,
body.viewport-phone.tc-text-visible-active.call-active .tc-text-line,
body.viewport-phone.tc-text-visible-active.call-active .call-panel.tc-text-full .tc-text-line {
  min-width: 0 !important;
  min-height: 72px !important;
  max-height: 120px !important;
  overflow: auto !important;
  padding: 7px 8px !important;
}

body.viewport-phone.call-active .tc-text-line p,
body.viewport-phone.call-active .call-panel.tc-text-full .tc-text-line p,
body.viewport-phone.tc-text-visible-active.call-active .tc-text-line p,
body.viewport-phone.tc-text-visible-active.call-active .call-panel.tc-text-full .tc-text-line p {
  font-size: 14px !important;
  line-height: 1.22 !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
}

body.viewport-phone.call-active .call-media-controls,
body.viewport-phone.tc-text-visible-active.call-active .call-media-controls {
  grid-row: 3 !important;
  width: 100% !important;
  max-width: 100vw !important;
  padding: 6px !important;
}

body.viewport-phone.call-active .composer,
body.viewport-phone.tc-text-visible-active.call-active .composer {
  grid-row: 5 !important;
  width: 100% !important;
  max-width: 100vw !important;
  padding: 6px 10px !important;
}

@media (max-width: 980px) {
  body.conversation-open .client-grid,
  body.developer-mode.conversation-open .client-grid,
  body.call-active .client-grid,
  body.tc-text-visible-active.call-active .client-grid {
    --conversation-list-width: 0px !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  body.conversation-open .conversation-list,
  body.call-active .conversation-list,
  body.tc-text-visible-active.call-active .conversation-list {
    display: none !important;
  }

  body.conversation-open .chat-panel,
  body.call-active .chat-panel,
  body.tc-text-visible-active.call-active .chat-panel {
    grid-column: 1 !important;
    width: 100% !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
  }
}

@media (max-width: 980px) and (orientation: portrait) {
  body.call-active .app-shell,
  body.tc-text-visible-active.call-active .app-shell {
    width: 100% !important;
    max-width: 100vw !important;
    min-height: 100dvh !important;
    height: auto !important;
    overflow-x: hidden !important;
  }

  body.call-active .chat-panel,
  body.tc-text-visible-active.call-active .chat-panel {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: auto auto auto auto auto auto auto !important;
    align-content: start !important;
    overflow-x: hidden !important;
  }

  body.call-active .call-panel,
  body.tc-text-full-active .call-panel,
  body.tc-text-visible-active.call-active .call-panel,
  body.tc-text-visible-active.call-active .call-panel.no-remote-video.local-video-main {
    grid-column: 1 !important;
    grid-row: 4 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: minmax(240px, 44dvh) auto auto !important;
    width: 100% !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  body.call-active .call-panel video,
  body.tc-text-visible-active.call-active .call-panel video,
  body.call-active .call-panel.local-video-main #localVideo,
  body.tc-text-visible-active.call-active .call-panel.local-video-main #localVideo {
    grid-column: 1 !important;
    grid-row: 1 !important;
    width: 100% !important;
    max-width: 100vw !important;
    height: 100% !important;
    min-height: 0 !important;
    object-fit: contain !important;
  }

  body.call-active .call-panel video.portrait-video,
  body.tc-text-visible-active.call-active .call-panel video.portrait-video {
    object-fit: contain !important;
  }

  body.call-active .call-panel:not(.local-video-main) #localVideo,
  body.tc-text-visible-active.call-active .call-panel:not(.local-video-main) #localVideo {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    bottom: auto !important;
    width: min(150px, 38vw) !important;
    height: auto !important;
  }

  body.call-active .tc-text-panel,
  body.call-active .call-panel.tc-text-full .tc-text-panel,
  body.tc-text-visible-active.call-active .tc-text-panel,
  body.tc-text-visible-active.call-active .call-panel.tc-text-full .tc-text-panel,
  body.call-active .call-panel.no-remote-video .tc-text-panel {
    position: static !important;
    grid-column: 1 !important;
    grid-row: 2 !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 6px !important;
    width: 100% !important;
    max-width: 100vw !important;
    margin: 0 !important;
    padding: 6px !important;
    pointer-events: auto !important;
  }

  body.call-active .tc-text-line,
  body.call-active .call-panel.tc-text-full .tc-text-line,
  body.tc-text-visible-active.call-active .tc-text-line,
  body.tc-text-visible-active.call-active .call-panel.tc-text-full .tc-text-line {
    min-width: 0 !important;
    min-height: 76px !important;
    max-height: 124px !important;
    padding: 7px 8px !important;
    overflow: auto !important;
  }

  body.call-active .tc-text-line p,
  body.call-active .call-panel.tc-text-full .tc-text-line p,
  body.tc-text-visible-active.call-active .tc-text-line p,
  body.tc-text-visible-active.call-active .call-panel.tc-text-full .tc-text-line p {
    min-height: 18px !important;
    font-size: 14px !important;
    line-height: 1.22 !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }

  body.call-active .call-media-controls,
  body.tc-text-visible-active.call-active .call-media-controls,
  body.call-active .call-panel.no-remote-video .call-media-controls {
    position: static !important;
    grid-column: 1 !important;
    grid-row: 3 !important;
    width: 100% !important;
    max-width: 100vw !important;
    margin: 0 !important;
    padding: 6px !important;
  }

  body.call-active .composer,
  body.tc-text-visible-active.call-active .composer {
    grid-column: 1 !important;
    grid-row: 7 !important;
    width: 100% !important;
    max-width: 100vw !important;
    padding: 6px 10px !important;
  }
}

body.viewport-phone.call-active:where(.tc-call-active, .tc-phone-keyboard-active) {
  min-height: 0;
  overflow: hidden;
}

body.viewport-phone.call-active .app-shell {
  padding: var(--call-safe-area-top) var(--call-safe-area-right) var(--call-safe-area-bottom) var(--call-safe-area-left);
}

body.viewport-phone.call-active:where(.tc-call-active, .tc-phone-keyboard-active) .app-shell {
  position: fixed;
  top: var(--visual-viewport-top, 0px);
  left: 0;
  right: 0;
  height: var(--visual-viewport-height, 100dvh) !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

body.viewport-phone.call-active:where(.tc-call-active) .chat-panel {
  grid-template-rows: auto minmax(0, 1fr) auto !important;
  min-height: 0;
  overflow: hidden !important;
}

body.viewport-phone.call-active:where(.tc-call-active) .chat-header {
  grid-row: 1;
}

body.viewport-phone.call-active:where(.tc-call-active) #callPanel {
  display: grid;
  grid-row: 2 !important;
  grid-template-rows: minmax(0, 1fr) auto auto !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: hidden !important;
}

body.viewport-phone.call-active:where(.tc-call-active) #composerForm {
  grid-row: 3 !important;
}

body.viewport-phone.call-active:where(.tc-call-active) #callPanel.tc-text-full {
  grid-template-rows: minmax(0, 1fr) auto !important;
}

body.viewport-phone.call-active:where(.tc-call-active) #callPanel.tc-text-full #totalConversationTextPanel {
  grid-row: 1 !important;
}

body.viewport-phone.call-active:where(.tc-call-active) #callPanel.tc-text-full .call-media-controls {
  grid-row: 2 !important;
}

body.viewport-phone.call-active .topbar {
  padding: 6px 10px;
}

body.viewport-phone.call-active .chat-header {
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
}

body.viewport-phone.call-active .chat-title {
  flex: 1 1 auto;
  min-width: 0;
  gap: 6px;
}

body.viewport-phone.call-active .chat-title > div:last-child {
  display: block;
  min-width: 0;
}

body.viewport-phone.call-active .chat-title h2 {
  margin: 0;
  font-size: 16px;
}

body.viewport-phone.call-active #activeConversationMeta {
  display: none;
}

body.viewport-phone.call-active .avatar-header {
  flex: 0 0 30px;
}

body.viewport-phone.call-active .chat-header-actions,
body.viewport-phone.call-active .call-controls {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  width: auto;
}

body.viewport-phone.call-active .call-controls .call-mode-button {
  flex: 0 0 44px;
  width: 44px;
  min-width: 44px;
  height: 44px;
}

body.viewport-phone.call-active .call-status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

body.viewport-phone.tc-phone-keyboard-active.call-active .app-shell {
  padding-bottom: 0;
  grid-template-rows: minmax(0, 1fr);
}

body.viewport-phone.tc-phone-keyboard-active.call-active .chat-panel {
  grid-template-rows: minmax(0, 1fr) auto !important;
  min-height: 0;
  overflow: hidden !important;
}

body.viewport-phone.tc-phone-keyboard-active.call-active .topbar,
body.viewport-phone.tc-phone-keyboard-active.call-active .app-tabs,
body.viewport-phone.tc-phone-keyboard-active.call-active .chat-header,
body.viewport-phone.tc-phone-keyboard-active.call-active .back-to-contacts,
body.viewport-phone.tc-phone-keyboard-active.call-active .send-row,
body.viewport-phone.tc-phone-keyboard-active.call-active #callResizeHandle,
body.viewport-phone.tc-phone-keyboard-active.call-active .call-device-controls,
body.viewport-phone.tc-phone-keyboard-active.call-active .volume-control {
  display: none !important;
}

body.viewport-phone.tc-phone-keyboard-active.call-active #callPanel {
  display: grid;
  grid-row: 1 !important;
  grid-template-rows: minmax(0, 1fr) auto auto !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: hidden !important;
}

body.viewport-phone.tc-phone-keyboard-active.call-active #callPanel > video {
  grid-row: 1;
  height: 100% !important;
  min-height: 0 !important;
  object-fit: contain !important;
}

body.viewport-phone.tc-phone-keyboard-active.call-active #callPanel:not(.local-video-main) #localVideo {
  width: min(92px, 24vw) !important;
  height: auto !important;
  max-height: 64px;
}

body.viewport-phone.tc-phone-keyboard-active.call-active #totalConversationTextPanel {
  grid-row: 2 !important;
  gap: 4px !important;
  padding: 4px !important;
}

body.viewport-phone.tc-phone-keyboard-active.call-active #totalConversationTextPanel .tc-text-line {
  min-height: 0 !important;
  height: 64px;
  max-height: 64px !important;
  padding: 4px 6px !important;
  overflow: auto !important;
}

body.viewport-phone.tc-phone-keyboard-active.call-active #callPanel .call-media-controls {
  position: static !important;
  grid-row: 3 !important;
  flex-wrap: nowrap;
  gap: 6px;
  padding: 4px !important;
  margin: 0;
  overflow-x: auto;
}

body.viewport-phone.tc-phone-keyboard-active.call-active #callPanel .call-media-icon-button {
  flex: 0 0 36px;
  height: 34px;
}

body.viewport-phone.tc-phone-keyboard-active.call-active #composerForm {
  grid-row: 2 !important;
  padding: 4px 8px !important;
}

body.viewport-phone.tc-phone-keyboard-active.call-active #callPanel.tc-text-full {
  grid-template-rows: minmax(0, 1fr) auto !important;
}

body.viewport-phone.tc-phone-keyboard-active.call-active #callPanel.tc-text-full #totalConversationTextPanel {
  grid-row: 1 !important;
}

body.viewport-phone.tc-phone-keyboard-active.call-active #callPanel.tc-text-full .call-media-controls {
  grid-row: 2 !important;
}

body.viewport-phone.tc-phone-keyboard-active.tc-phone-landscape-active #callPanel:not(.tc-text-full) {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  grid-template-rows: minmax(0, 1fr) auto !important;
}

body.viewport-phone.tc-phone-keyboard-active.tc-phone-landscape-active #callPanel:not(.tc-text-full) > video {
  grid-column: 1 !important;
  grid-row: 1 / -1 !important;
}

body.viewport-phone.tc-phone-keyboard-active.tc-phone-landscape-active #callPanel:not(.local-video-main) #localVideo {
  right: calc(50% + 8px) !important;
}

body.viewport-phone.tc-phone-keyboard-active.tc-phone-landscape-active #callPanel:not(.tc-text-full) #totalConversationTextPanel {
  grid-column: 2 !important;
  grid-row: 1 !important;
  min-height: 0;
  overflow: auto;
}

body.viewport-phone.tc-phone-keyboard-active.tc-phone-landscape-active #callPanel:not(.tc-text-full) .call-media-controls {
  grid-column: 2 !important;
  grid-row: 2 !important;
}

button.group-member-menu-button,
body[data-theme] button.group-member-menu-button {
  border-color: transparent !important;
  background: transparent !important;
  color: #111827 !important;
  box-shadow: none !important;
}

button.group-member-menu-button:hover:not(:disabled),
button.group-member-menu-button:focus-visible,
body[data-theme] button.group-member-menu-button:hover:not(:disabled),
body[data-theme] button.group-member-menu-button:focus-visible {
  border-color: transparent !important;
  background: transparent !important;
  color: var(--accent-strong) !important;
  box-shadow: none !important;
  outline: none !important;
}

html body.call-active #callPanel.has-interpreter > video#remoteVideo {
  position: absolute !important; top: 6px !important; right: 6px !important; bottom: auto !important; left: auto !important;
  width: 28% !important; height: 36% !important; min-width: 0 !important; min-height: 0 !important; max-height: none !important; object-fit: contain !important; transform: none !important;
}
html body.call-active #callPanel.has-interpreter > video#localVideo {
  position: absolute !important; top: 39% !important; right: 6px !important; bottom: auto !important; left: auto !important;
  width: 28% !important; height: 26% !important; min-width: 0 !important; min-height: 0 !important; max-height: none !important; object-fit: contain !important; transform: none !important;
}
html body #callPanel.has-interpreter #interpreterTile { inset: 6px 31% 56px 6px; min-width: 0; min-height: 0; }
html body #callPanel.has-interpreter #interpreterVideo {
  display: block !important; position: absolute !important; inset: 38px 0 36px 0 !important;
  width: 100% !important; height: calc(100% - 74px) !important; min-height: 0 !important; max-height: none !important; object-fit: contain !important; transform: none !important; border-radius: 0 !important;
}
html body #callPanel.has-interpreter .interpreter-caption { min-height: 36px; z-index: 4; font-size: 12px; }
html body #callPanel.has-interpreter .interpreter-caption strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html body #callPanel.has-interpreter #interpreterRemove { flex: 0 0 36px; min-height: 32px; font-size: 22px; padding: 0; }
html body #callPanel.has-interpreter #totalConversationTextPanel { position: absolute !important; top: auto !important; left: auto !important; right: 6px !important; bottom: 56px !important; width: 28% !important; max-height: 24%; overflow: auto; grid-template-columns: 1fr !important; }
html body #callPanel.has-interpreter #totalConversationTextPanel .tc-text-line { min-width: 0; padding: 4px; }
html body #callPanel.has-interpreter #totalConversationTextPanel p { font-size: 12px; }
html body #callPanel.has-interpreter .call-media-controls { position: absolute !important; inset: auto 6px 6px !important; width: auto !important; max-width: calc(100% - 12px) !important; height: 44px; margin: 0 !important; padding: 4px !important; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; z-index: 3; }
html body #callPanel.has-interpreter .call-media-controls > * { flex-shrink: 0; }
