:root {
  --app-background: #ffffff;
  --black-color: #000000;
  --white-color: #ffffff;
  --red-color: #e50914;
  --gray-color: #888888;
  --muted-color: #666666;
  --line-color: #e0e0e0;
  --soft-gray-color: #cccccc;
  --pending-color: #c5c2c2;
  --orange-color: #e67e22;
  --green-color: rgb(112, 178, 110);
  --yellow-color: rgb(215, 175, 26);
  --blue-color: rgb(52, 103, 153);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body,
.app {
  height: 100%;
  height: 100dvh;
}

.app {
  position: relative;
  display: flex;
  flex-direction: column;
}

body {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  background-color: var(--app-background);
  color: var(--black-color);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

/* ---- Auth (Swiss) ---- */
.auth-screen {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}

.auth-box {
  width: 100%;
  max-width: 420px;
}

.auth-box .brand {
  font-size: 16pt;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.4px;
}

.auth-box .brand-sub {
  font-size: 8.5pt;
  color: var(--red-color);
  font-weight: bold;
  text-transform: lowercase;
  margin: 6px 0 24px;
}

.tabs {
  display: flex;
  border-bottom: 1px solid #e0e0e0;
  margin-bottom: 20px;
}

.tabs button {
  background: none;
  border: none;
  padding: 10px 0 12px;
  padding-inline-end: 14px;
  margin-inline-end: 18px;
  font-size: 9pt;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: lowercase;
  color: #888888;
}

.tabs button.active {
  color: #000000;
  border-bottom: 2px solid var(--red-color);
}

.form label {
  display: block;
  font-size: 8.5pt;
  font-weight: bold;
  text-transform: lowercase;
  letter-spacing: 0.8px;
  margin-bottom: 14px;
}

.form .field-note {
  font-weight: 400;
  letter-spacing: 0.4px;
  text-transform: none;
  color: var(--gray-color);
}

.form .field-error {
  display: block;
  margin-top: 6px;
  font-size: 8pt;
  font-weight: 400;
  letter-spacing: 0.2px;
  text-transform: none;
  color: var(--red-color);
}

.form input {
  display: block;
  width: 100%;
  margin-top: 6px;
  border: none;
  border-bottom: 1px solid #e0e0e0;
  padding: 8px 0;
  outline: none;
  background: #ffffff;
}

.form button[type="submit"],
.btn-send,
.primary-btn {
  background-color: var(--red-color);
  color: #ffffff;
  font-size: 10pt;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 10px 24px;
  border: none;
  margin-top: 8px;
}

.form button[type="submit"]:hover,
.btn-send:hover,
.primary-btn:hover {
  background-color: #000000;
}

.banner {
  font-size: 9pt;
  margin-bottom: 14px;
  color: #000000;
}

.banner.error {
  color: var(--red-color);
  font-weight: bold;
}

.muted {
  font-size: 8.5pt;
  color: #888888;
}

/* ---- App shell ---- */
.app-container {
  display: flex;
  flex: 1;
  width: 100vw;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  will-change: transform;
}

.contacts-sidebar {
  --phi: 1.618033988749895;
  --phi-axis: calc(100% / var(--phi) / var(--phi));
  width: 30%;
  min-width: 260px;
  height: 100%;
  border-inline-end: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e0e0e0;
  height: 80px;
  min-height: 80px;
  max-height: 50vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  cursor: default;
  user-select: auto;
  overflow: hidden;
  flex-shrink: 0;
  transition: height 0.2s ease;
}

.search-split {
  display: grid;
  grid-template-columns: var(--phi-axis) minmax(0, 1fr);
  column-gap: 0;
  align-items: start;
}

.search-west {
  text-align: end;
  padding-inline-end: 8px;
  min-width: 0;
}

.search-east {
  text-align: start;
  padding-inline-start: 8px;
  min-width: 0;
}

.sidebar-search-row {
  flex-shrink: 0;
  align-items: end;
  border-bottom: none;
  position: relative;
}

.search-dropdown {
  background-image: none;
}

.search-label {
  font-size: 8.5pt;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #888888;
  padding-bottom: 4px;
}

.sidebar-header.searching .search-label {
  color: #000000;
}

.search-field-east {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  border-bottom: 1px dashed #e0e0e0;
  padding-bottom: 8px;
}

.sidebar-header input[type="search"] {
  width: 100%;
  flex: 1;
  border: none;
  padding: 0;
  outline: none;
  font-size: 12pt;
  font-weight: 500;
  line-height: 1.2;
  background: transparent;
  color: #000000;
}

.sidebar-header input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.search-clear {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: none;
  background: none;
  color: #888888;
  font-size: 12pt;
  line-height: 1;
  padding: 0;
}

.search-clear:hover {
  color: #000000;
}

.sidebar-header.searching {
  height: auto;
  max-height: 50vh;
}

.sidebar-header .search-dropdown {
  flex: 0 1 auto;
  min-height: 0;
  max-height: calc(50vh - 72px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin-top: 0;
}

.sidebar-header h2 {
  font-size: 13pt;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-header p {
  font-size: 8pt;
  color: var(--red-color);
  font-weight: bold;
  margin-top: 4px;
  text-transform: lowercase;
}

.sidebar-header-extra {
  font-size: 8.5pt;
  color: #666666;
  margin-top: 12px;
  line-height: 1.4;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.sidebar-header.expanded .sidebar-header-extra {
  opacity: 1;
}

.pending-contacts {
  flex-shrink: 0;
  border-bottom: 1px solid #e0e0e0;
}

.pending-contact-list {
  list-style: none;
}

.pending-contact-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pending-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.pending-actions .accept-btn,
.pending-actions .reject-btn,
.connect-btn {
  background: #ffffff;
  border: 1px solid #000000;
  color: #000000;
  padding: 4px 8px;
  font-size: 7.5pt;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.pending-actions .reject-btn {
  border-color: #888888;
  color: #888888;
}

.contact-item.active .pending-actions .accept-btn,
.contact-item.active .pending-actions .reject-btn {
  background: transparent;
  border-color: #ffffff;
  color: #ffffff;
}

.chat-header.is-idle .date-label,
.chat-header.is-idle .title {
  min-height: 0;
  margin: 0;
  font-size: 0;
}

.search-dropdown {
  list-style: none;
  margin: 0;
  padding: 0;
}

.search-module {
  padding: 12px 0 8px;
  font-size: 8.5pt;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #000000;
  background-color: var(--app-background);
  position: sticky;
  top: 0;
  z-index: 1;
  cursor: default;
  list-style: none;
  align-items: baseline;
}

.search-module-count {
  font-size: 8.5pt;
  font-weight: 400;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  text-align: start;
}

.search-module-label.is-public {
  color: var(--red-color);
}

.search-row {
  list-style: none;
}

.search-row-btn {
  width: 100%;
  background: none;
  border: none;
  border-radius: 0;
  padding: 12px 0;
  box-shadow: none;
  cursor: pointer;
  color: inherit;
  position: relative;
  align-items: end;
}

.search-row-public .search-row-btn {
  align-items: start;
}

.search-dropdown,
.search-dropdown li {
  border: none;
  box-shadow: none;
}

.search-handle {
  font-size: 8.5pt;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: #666666;
  line-height: 1.2;
  word-break: break-word;
}

.search-primary {
  font-size: 12pt;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  word-break: break-word;
}

.search-public-west {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.search-secondary {
  font-size: 8.5pt;
  font-weight: 300;
  letter-spacing: 0.02em;
  color: #666666;
  text-transform: lowercase;
  line-height: 1.25;
}

.search-participants {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.search-row-btn.is-focused,
.search-row-btn:hover {
  background: #000000;
  color: #ffffff;
}

.search-row-btn.is-focused .search-handle,
.search-row-btn:hover .search-handle,
.search-row-btn.is-focused .search-secondary,
.search-row-btn:hover .search-secondary,
.search-row-btn.is-focused .search-participants,
.search-row-btn:hover .search-participants {
  color: #cccccc;
}

.search-row-btn.is-focused .search-module-label.is-public,
.search-row-public .search-row-btn.is-focused .search-primary {
  color: inherit;
}

.search-status {
  align-items: baseline;
  padding: 16px 0;
  list-style: none;
}

.search-status-num {
  font-size: 12pt;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.search-status-caption {
  font-size: 8.5pt;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #888888;
}

.search-status-caption.is-critical {
  color: var(--red-color);
  font-weight: 800;
}

.invitation-item {
  width: 100%;
  text-align: start;
  background: none;
  border: none;
  padding: 8px 0;
  border-bottom: 1px solid #e0e0e0;
  cursor: pointer;
}

.invitation-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.inv-actions button {
  background: none;
  border: 1px solid #000;
  padding: 4px 8px;
  font-size: 7.5pt;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.inv-actions .reject-btn {
  border-color: #888;
  color: #888;
}

.contact-list,
.invitation-list {
  list-style: none;
}

.contact-list {
  flex: 1;
  overflow-y: auto;
}

.contact-section-header,
.search-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 20px 6px 20px;
  font-size: 8.5pt;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #000000;
  list-style: none;
  cursor: default;
}

.contact-section-label {
  color: #888888;
}

.contact-section-meta {
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  color: #888888;
}

.contact-section-header.is-public-conversation,
.contact-section-header.is-public-conversation .contact-section-label {
  color: var(--red-color);
}

.contact-section-header.is-public-conversation .contact-section-meta {
  color: var(--red-color);
}

.search-section-header {
  padding: 10px 8px 4px 8px;
}

.search-empty button {
  color: #888888;
}

.contact-item {
  padding: 16px 20px;
  border-bottom: none;
  cursor: pointer;
}

.contact-item:hover {
  background-color: #000000;
  color: #ffffff;
}

.contact-item:hover .contact-date,
.contact-item:hover .contact-status,
.contact-item:hover .contact-role,
.contact-item:hover .search-handle {
  color: #cccccc;
}

.contact-item.is-public-chat {
  display: block;
}

.contact-public-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.contact-public-line {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
}

.contact-public-line .contact-name {
  min-width: 0;
  text-align: start;
}

.contact-role {
  flex-shrink: 0;
  font-size: 8.5pt;
  font-weight: 400;
  text-transform: lowercase;
  color: #888888;
}

.contact-participants {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
}

.contact-item.has-status,
.pending-contact-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.contact-status {
  flex-shrink: 0;
  font-size: 8.5pt;
  font-weight: 700;
  text-transform: lowercase;
  letter-spacing: 0.4px;
  color: #888888;
}

.contact-item.active .contact-status,
.contact-item.active .contact-role,
.contact-item.active .search-handle {
  color: #cccccc;
}

.contact-item.active {
  background-color: #000000;
  color: #ffffff;
}

.contact-name {
  font-size: 11pt;
  font-weight: 700;
}

.contact-date {
  font-size: 8.5pt;
  color: #666666;
  margin-top: 4px;
  font-variant: small-caps;
  text-transform: lowercase;
  letter-spacing: 0.8px;
}

.contact-item.active .contact-date {
  color: var(--red-color);
}

.main-chat {
  width: 70%;
  flex-grow: 1;
  height: 100%;
  max-height: calc(100% - 40px);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.read-area {
  height: 50%;
  width: 100%;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  transition: height 0.35s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.2s ease;
  flex-shrink: 0;
}

.chat-header {
  --phi: 1.618033988749895;
  --phi-axis: calc(100% / var(--phi) / var(--phi));
  border-bottom: 1px solid #e0e0e0;
  padding: 16px 32px 22px;
  height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  cursor: default;
  user-select: none;
  overflow: hidden;
  overscroll-behavior: contain;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: var(--app-background);
}

.chat-header-masthead {
  flex: 0 0 auto;
}

.chat-header-masthead .chat-header-anchor {
  margin-top: 8px;
}

.chat-header .title-row:empty {
  display: none;
}

.chat-header .date-label {
  font-size: 8.5pt;
  font-weight: 400;
  color: #000000;
  font-variant: small-caps;
  text-transform: lowercase;
  letter-spacing: 0.8px;
  text-align: center;
}

.chat-header-anchor {
  width: 100%;
  text-align: center;
}

.chat-header .title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.chat-header .title {
  font-size: 12pt;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.5px;
  text-align: center;
}

.credits-roll {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: flex-start;
  column-gap: 1rem;
  row-gap: 0.35rem;
  width: 100%;
  max-width: 72rem;
  margin: 12px auto 0;
  padding: 0 10%;
  box-sizing: border-box;
}

.credits-name {
  flex: 0 1 10rem;
  max-width: 16rem;
  font-size: 10pt;
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1.35;
  text-align: center;
}

.credits-name.is-self {
  font-style: italic;
}

.credits-roll-atrium {
  padding: 0 12%;
}

.credits-roll-atrium .credits-name {
  font-size: 8pt;
}

.credits-vote-sq {
  width: 10px;
  height: 10px;
  padding: 0;
  border: 1px solid var(--red-color);
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  cursor: pointer;
}

.credits-vote-sq.is-accepted {
  background: var(--red-color);
}

.credits-name.is-pending {
  color: #c5c2c2;
  flex: none;
  height: auto;
}

.credits-pending {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 1 10rem;
  max-width: 16rem;
  margin: 8px 0;
  gap: 2px;
}

.credits-vote {
  display: flex;
  gap: 6px;
  margin-top: 0;
}

.credits-vote-btn {
  background: none;
  border: 1px solid #000000;
  border-radius: 0;
  box-shadow: none;
  padding: 3px 8px;
  font-size: 8.5pt;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #000000;
  cursor: pointer;
}

.credits-vote-btn.is-selected {
  background: #000000;
  color: #ffffff;
}

.credits-add-btn {
  display: block;
  margin: 10px auto 0;
  border: none;
  background: none;
  padding: 0;
  font-size: 14pt;
  font-weight: 400;
  line-height: 1;
  color: #000000;
  cursor: pointer;
}

.credits-invite {
  width: 100%;
  max-width: 72rem;
  margin: 12px auto 0;
  padding: 0 20%;
  box-sizing: border-box;
  text-align: center;
}

.credits-invite-input {
  display: block;
  width: 100%;
  max-width: 24rem;
  margin: 0 auto;
  border: none;
  border-bottom: 1px dashed #e0e0e0;
  padding: 6px 0;
  outline: none;
  font-size: 12pt;
  font-weight: 500;
  text-align: center;
  background: transparent;
}

.credits-invite-results {
  margin-top: 12px;
  max-height: min(40vh, 280px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  text-align: start;
  flex: 0 1 auto;
}

.credits-invite-results .search-primary {
  font-size: 10pt;
}

.credits-atrium-heading {
  margin: 45px auto 0;
  text-align: center;
  font-size: 8.5pt;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.credits-atrium-count {
  margin: 4px auto 0;
  text-align: center;
  font-size: 8.5pt;
  font-weight: 400;
  color: #888888;
}

.chat-header-drag-foot {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  z-index: 2;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 6px 0;
  cursor: row-resize;
}

.chat-header-caret {
  display: block;
  color: var(--yellow-color);
  transform: rotate(calc(var(--header-open, 0) * 180deg));
  transition: transform 0.25s cubic-bezier(0.25, 1, 0.5, 1);
}

.header-leave-btn {
  display: none;
  position: absolute;
  inset-inline-end: 32px;
  bottom: 12px;
  background: none;
  border: 1px solid #000;
  padding: 4px 10px;
  font-size: 7.5pt;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.chat-header.expanded .header-leave-btn {
  display: block;
}

.chat-header.has-header-actions {
  height: 118px;
}

.header-connect-actions,
.header-pending-actions,
.header-membership-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-shrink: 0;
  margin-top: 10px;
}

.connect-btn {
  flex-shrink: 0;
  border: 1px solid #000;
  background: #fff;
  padding: 4px 10px;
  font-size: 8pt;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.chat-header-extra {
  font-size: 8.5pt;
  color: #666;
  margin-top: 10px;
  line-height: 1.45;
  opacity: 0;
  display: none;
}

.chat-header.expanded .chat-header-extra {
  display: block;
  opacity: 1;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: 28px;
}

.chat-header.invite-searching .chat-header-extra {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
}

.chat-header.invite-searching .credits-invite:not([hidden]) {
  flex: 0 0 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.chat-header.invite-searching .credits-invite-results {
  flex: 0 1 auto;
  max-height: min(40vh, 280px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.management-panel {
  padding: 8px 0 4px;
}

.management-panel .invite-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 8px 0 12px;
  flex-wrap: wrap;
}

.management-panel .invite-search-wrap {
  position: relative;
  flex: 1 1 220px;
  min-width: 180px;
}

.management-panel .invite-search-dropdown {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  border: 1px solid #e0e0e0;
  background: #fff;
  max-height: 220px;
  overflow-y: auto;
}

.management-panel .invite-result {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid #f0f0f0;
}

.management-panel .invite-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.management-panel input[type="search"],
.management-panel input[type="text"] {
  border: none;
  border-bottom: 1px solid #e0e0e0;
  padding: 4px 0;
  outline: none;
  min-width: 160px;
}

.member-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 8.5pt;
}

.member-table th,
.member-table td {
  text-align: start;
  padding: 6px 8px 6px 0;
  border-bottom: 1px solid #e0e0e0;
}

.message-stream {
  padding: 24px 32px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  -webkit-overflow-scrolling: touch;
}

.msg-row {
  clear: both;
  font-weight: 400;
}

.msg-meta {
  font-size: 8pt;
  font-weight: 400;
  color: var(--red-color);
  margin-bottom: 6px;
}

.msg-author {
  cursor: default;
}

.date-text,
.date-hover {
  font-variant: small-caps;
  text-transform: lowercase;
  letter-spacing: 0.8px;
}

.date-text {
  color: var(--gray-color);
  font-weight: normal;
  margin-inline-start: 6px;
}

.date-hover {
  display: none;
  color: var(--black-color);
  font-weight: 400;
  margin-inline-start: 6px;
  text-transform: none;
  font-variant: normal;
  letter-spacing: 0;
}

.msg-author:hover ~ .date-hover {
  display: inline;
}

.msg-author:hover ~ .date-text {
  display: none;
}

.msg-body {
  font-size: 10pt;
  line-height: 1.5;
  width: 60ch;
  max-width: 100%;
  color: #000000;
  hyphens: auto;
  word-break: break-word;
}

.msg-body.locked {
  color: var(--red-color);
  font-style: italic;
}

.msg-row.outgoing {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: end;
}

.msg-row.outgoing .msg-meta {
  color: #000000;
  display: flex;
  flex-direction: row-reverse;
  align-items: baseline;
  gap: 6px;
  width: 60ch;
  max-width: 100%;
  margin-bottom: 6px;
}

.msg-row.outgoing .date-text,
.msg-row.outgoing .date-hover {
  margin-inline-start: 0;
}

.msg-row.outgoing .msg-body {
  display: block;
  width: 60ch;
  max-width: 100%;
  text-align: start;
  color: #000000;
}

.empty-state {
  font-size: 9pt;
  color: #888;
}

.write-area {
  height: 50%;
  width: 100%;
  padding: 16px 32px 24px 32px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: height 0.35s cubic-bezier(0.25, 1, 0.5, 1);
  flex-shrink: 0;
}

.main-chat.dock-bottom .read-area {
  height: 75%;
  width: 100%;
}
.main-chat.dock-bottom .write-area {
  height: 25%;
  width: 100%;
}

.main-chat.dock-middle .read-area {
  height: 50%;
  width: 100%;
}
.main-chat.dock-middle .write-area {
  height: 50%;
  width: 100%;
}

.main-chat.dock-top .read-area {
  height: auto;
  min-height: min-content;
  width: 100%;
  flex: none;
}
.main-chat.dock-top .message-stream {
  overflow-y: visible;
  height: auto;
}
.main-chat.dock-top .write-area {
  height: calc(100vh - 40px);
  min-height: calc(100vh - 40px);
  width: 100%;
  flex: none;
}

.main-chat.dock-side {
  flex-direction: row;
}
.main-chat.dock-side .read-area {
  height: 100%;
  width: 60%;
  border-bottom: none;
  border-inline-end: 1px solid #e0e0e0;
}
.main-chat.dock-side .write-area {
  height: 100%;
  width: 40%;
}

.main-chat.dock-readonly .read-area {
  height: 100%;
  width: 100%;
  flex: 1;
}

.contact-delete-btn {
  flex-shrink: 0;
}

.contact-item.active .contact-delete-btn {
  border-color: #ffffff;
  color: #ffffff;
}

.write-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  min-height: 24px;
  flex-shrink: 0;
}

.draft-status {
  flex-shrink: 0;
  font-size: 8pt;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #888888;
  white-space: nowrap;
}

.draft-status.saved-local {
  color: var(--orange-color);
}

.draft-status.saved-remote {
  color: var(--green-color);
}

.write-area > .ql-toolbar,
.write-toolbar #quill-toolbar-slot,
.write-toolbar .ql-toolbar,
.write-toolbar #quill-toolbar.ql-toolbar,
.write-toolbar #quill-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-height: 24px;
  max-height: none;
  padding: 0;
  border: none;
  visibility: visible;
  opacity: 1;
  overflow: visible;
  font-family: inherit;
}

.write-toolbar .ql-toolbar.ql-snow,
.write-toolbar #quill-toolbar.ql-snow {
  border: none;
  padding: 0;
}

.write-toolbar .ql-formats {
  display: inline-flex;
  align-items: center;
  margin-inline-end: 8px;
}

.write-toolbar .ql-snow.ql-toolbar button,
.write-toolbar #quill-toolbar button {
  float: none;
  width: 24px;
  height: 24px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.write-toolbar .ql-snow.ql-toolbar button svg,
.write-toolbar #quill-toolbar button svg {
  width: 16px;
  height: 16px;
}

.write-toolbar .ql-snow .ql-picker {
  height: 24px;
}

.write-toolbar .ql-snow .ql-picker-label {
  display: flex;
  align-items: center;
  height: 24px;
  padding: 0 4px;
}

.write-toolbar .ql-snow .ql-stroke {
  stroke: #000;
}

.write-toolbar .ql-snow .ql-fill {
  fill: #000;
}

.write-toolbar .ql-snow.ql-toolbar button:hover,
.write-toolbar .ql-snow.ql-toolbar button.ql-active,
.write-toolbar #quill-toolbar button.ql-active {
  color: var(--red-color);
}

.write-toolbar .ql-snow.ql-toolbar button.ql-active .ql-stroke {
  stroke: var(--red-color);
}

.write-toolbar .ql-snow.ql-toolbar button.ql-active .ql-fill {
  fill: var(--red-color);
}

.write-toolbar .ql-snow .ql-picker.ql-size,
.write-toolbar .ql-snow .ql-picker.ql-font {
  color: #444444;
}

.write-toolbar .ql-snow .ql-picker.ql-size .ql-picker-label,
.write-toolbar .ql-snow .ql-picker.ql-font .ql-picker-label,
.write-toolbar .ql-snow .ql-picker.ql-size .ql-picker-label.ql-active,
.write-toolbar .ql-snow .ql-picker.ql-font .ql-picker-label.ql-active,
.write-toolbar .ql-snow .ql-picker.ql-size.ql-expanded .ql-picker-label,
.write-toolbar .ql-snow .ql-picker.ql-font.ql-expanded .ql-picker-label {
  color: #444444;
}

.write-toolbar .ql-snow .ql-picker.ql-size .ql-stroke,
.write-toolbar .ql-snow .ql-picker.ql-font .ql-stroke,
.write-toolbar .ql-snow .ql-picker.ql-size .ql-picker-label.ql-active .ql-stroke,
.write-toolbar .ql-snow .ql-picker.ql-font .ql-picker-label.ql-active .ql-stroke {
  stroke: #444444;
}

.write-toolbar .ql-snow .ql-picker.ql-size {
  width: 42px;
}

.write-toolbar .ql-snow .ql-picker.ql-size .ql-picker-label::before,
.write-toolbar .ql-snow .ql-picker.ql-size .ql-picker-item::before {
  content: 'S';
}

.write-toolbar .ql-snow .ql-picker.ql-size .ql-picker-label[data-value="12px"]::before,
.write-toolbar .ql-snow .ql-picker.ql-size .ql-picker-item[data-value="12px"]::before {
  content: 'XS';
}

.write-toolbar .ql-snow .ql-picker.ql-size .ql-picker-label[data-value="16px"]::before,
.write-toolbar .ql-snow .ql-picker.ql-size .ql-picker-item[data-value="16px"]::before {
  content: 'S';
}

.write-toolbar .ql-snow .ql-picker.ql-size .ql-picker-label[data-value="22px"]::before,
.write-toolbar .ql-snow .ql-picker.ql-size .ql-picker-item[data-value="22px"]::before {
  content: 'M';
}

.write-toolbar .ql-snow .ql-picker.ql-size .ql-picker-label[data-value="30px"]::before,
.write-toolbar .ql-snow .ql-picker.ql-size .ql-picker-item[data-value="30px"]::before {
  content: 'L';
}

.write-toolbar .ql-snow .ql-picker.ql-size .ql-picker-label[data-value="48px"]::before,
.write-toolbar .ql-snow .ql-picker.ql-size .ql-picker-item[data-value="48px"]::before {
  content: 'XL';
}

.write-area,
.write-toolbar {
  overflow: visible;
}

#quill-editor.ql-container,
#quill-editor.editor-box {
  width: 100%;
  flex: 1;
  border: none;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.5;
  overflow-y: auto;
}

#quill-editor .ql-editor {
  padding: 0;
  min-height: 100%;
  font-size: 11pt;
  line-height: 1.5;
}

#quill-editor .ql-editor.ql-blank::before {
  inset-inline: 0;
  font-style: normal;
  color: #888888;
}

.msg-body .ql-editor {
  padding: 0;
  width: 100%;
  font-size: inherit;
  line-height: inherit;
}

.msg-body .ql-editor p,
.msg-body .ql-editor div {
  width: 100%;
}

.dock-control-icon {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px;
  width: 28px;
  height: 24px;
  padding: 2px;
  user-select: none;
}

.horizontal-bars {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

.bar-btn {
  background-color: #888888;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.bar-btn.horiz {
  width: 100%;
  height: 3px;
  border-radius: 1px;
}
.bar-btn.vert {
  width: 3px;
  height: 100%;
  border-radius: 1px;
}
.bar-btn:hover {
  background-color: #000000;
}
.bar-btn.active {
  background-color: var(--red-color);
}

.editor-box {
  width: 100%;
  flex: 1;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 11pt;
  line-height: 1.5;
  color: #000000;
  resize: none;
  outline: none;
}

.editor-box:disabled {
  color: #888888;
}

.action-bar {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.action-bar .draft-status {
  margin-inline-end: auto;
}

.action-bar .btn-send {
  margin-inline-start: auto;
}

.btn-send:disabled {
  background-color: #888888;
  cursor: not-allowed;
}

.bottom-bar {
  height: 40px;
  width: 100vw;
  display: flex;
  background-color: transparent;
  position: absolute;
  bottom: 0;
  inset-inline-start: 0;
  z-index: 20;
  will-change: transform;
  pointer-events: none;
}

.bottom-bar-sidebar {
  --header-open: 0;
  width: 100%;
  min-width: 0;
  height: 40px;
  border-top: 1px solid #e0e0e0;
  border-inline-end: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 0 5px 0 20px;
  font-size: 8.5pt;
  font-weight: bold;
  letter-spacing: 1px;
  text-transform: lowercase;
  color: inherit;
  cursor: default;
  user-select: none;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
  transition: height 0.25s cubic-bezier(0.25, 1, 0.5, 1);
}

.bottom-bar-sidebar-title {
  flex-shrink: 0;
  height: 40px;
  display: flex;
  align-items: center;
  font-size: calc(8.5pt + (5pt * var(--header-open, 0)));
  color: rgb(
    calc(136 - 136 * var(--header-open, 0)),
    calc(136 - 136 * var(--header-open, 0)),
    calc(136 - 136 * var(--header-open, 0))
  );
  transform-origin: inline-start center;
  pointer-events: auto;
  cursor: row-resize;
}

.bottom-bar-sidebar-extra {
  font-size: 8pt;
  font-weight: normal;
  color: #666666;
  margin-bottom: 0;
  padding-bottom: 12px;
  padding-inline-end: 10px;
  line-height: 1.4;
  opacity: 0;
  transition: opacity 0.2s ease;
  text-transform: none;
  cursor: default;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #c8c8c8 transparent;
}

.bottom-bar-sidebar-extra::-webkit-scrollbar {
  width: 4px;
}

.bottom-bar-sidebar-extra::-webkit-scrollbar-track {
  background: transparent;
}

.bottom-bar-sidebar-extra::-webkit-scrollbar-thumb {
  background: #c8c8c8;
}

.bottom-bar-sidebar.expanded {
  height: var(--expanded-height, 50vh);
  max-height: 50vh;
}

.bottom-bar-sidebar.expanded .bottom-bar-sidebar-extra {
  opacity: 1;
}

.settings-password-panel .settings-field,
.settings-keys-panel .settings-field {
  margin: 0;
}

.settings-field {
  display: grid;
  grid-template-columns: minmax(5.5rem, 34%) minmax(0, 1fr);
  column-gap: 10px;
  row-gap: 4px;
  align-items: start;
  margin: 10px 0;
}

.settings-label {
  font-size: 8pt;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  text-align: end;
  color: #000000;
  padding-top: 0;
  align-self: start;
}

.settings-controls {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
}

.settings-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 10px;
  column-gap: 8px;
  align-items: start;
  min-width: 0;
}

.settings-input {
  width: 100%;
  flex: 1;
  min-width: 0;
  font-size: 11pt;
  font-weight: 400;
  color: #000000;
  background: transparent;
  outline: none;
  padding: 4px 6px;
}

.settings-input-line {
  border: none;
  border-bottom: 1px solid #e0e0e0;
}

.settings-input-box {
  border: 1px solid #e0e0e0;
  padding: 4px 6px;
}

.settings-password-panel .settings-input-row,
.settings-keys-panel .settings-input-row,
.settings-keys-install .settings-input-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  grid-template-columns: none;
}

.settings-password-panel .settings-input,
.settings-keys-panel .settings-input,
.settings-keys-install .settings-input,
.settings-input-compact {
  margin: 0;
  font-size: 8pt;
  width: 75%;
  max-width: 75%;
  flex: 0 0 75%;
}

.settings-save-sq {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  align-self: start;
  margin-top: 6px;
  padding: 0;
  border: 1px solid var(--green-color);
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  cursor: pointer;
}

.settings-save-sq.is-saved {
  background: var(--green-color);
  cursor: pointer;
}

.settings-input-row-end {
  justify-content: flex-end;
}

#realtime-toggle.settings-save-sq {
  cursor: pointer;
}

.settings-btn {
  align-self: flex-start;
  background: none;
  border: 1px solid #000;
  padding: 4px 10px;
  font-size: 8pt;
  font-weight: bold;
  text-transform: none;
  letter-spacing: 0;
}

.settings-btn-end {
  align-self: flex-end;
}

.settings-error {
  display: block;
  font-size: 8pt;
  font-weight: 400;
  color: var(--red-color);
  text-transform: none;
  letter-spacing: 0;
  margin: 2px 0 0;
}

.settings-error[hidden] {
  display: none;
}

.settings-e2ee-missing {
  color: var(--red-color);
}

.settings-e2ee-ok {
  color: #666666;
}

.settings-hint {
  font-size: 7pt;
  font-weight: 400;
  color: #aaaaaa;
  text-transform: none;
  letter-spacing: 0;
}

.settings-otp-row,
.settings-password-panel,
.settings-keys-panel,
.settings-keys-install {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-otp-row[hidden],
.settings-password-panel[hidden],
.settings-keys-panel[hidden],
.settings-keys-install[hidden] {
  display: none;
}

.settings-subrow {
  display: grid;
  grid-template-columns: minmax(4.5rem, 38%) minmax(0, 1fr);
  column-gap: 8px;
  align-items: center;
}

.settings-sublabel {
  font-size: 7.5pt;
  font-weight: 500;
  text-align: end;
  text-transform: none;
  letter-spacing: 0;
  color: #666666;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}

.settings-row input[type="password"] {
  border: none;
  border-bottom: 1px solid #e0e0e0;
  padding: 4px 0;
  outline: none;
  min-width: 140px;
}

.settings-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.settings-actions button,
.secondary-btn {
  background: none;
  border: 1px solid #000;
  padding: 4px 10px;
  font-size: 7.5pt;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.bottom-bar-main {
  width: 70%;
  margin-inline-start: 30%;
  height: 40px;
  min-height: 40px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: absolute;
  bottom: 0;
  inset-inline-end: 0;
  pointer-events: auto;
}

.bottom-bar-logo {
  display: block;
  height: 22px;
  width: auto;
  max-height: calc(100% - 12px);
}

@media (max-width: 768px) {
  .credits-name {
    flex: 0 1 7rem;
  }

  .app-container,
  .bottom-bar {
    width: 200vw;
    transform: translateX(-100vw);
  }

  .contacts-sidebar {
    width: 100vw;
    min-width: 100vw;
    flex-shrink: 0;
  }

  .main-chat {
    width: 100vw;
    min-width: 100vw;
    flex-shrink: 0;
  }

  .bottom-bar-sidebar {
    width: 100%;
    min-width: 0;
  }

  .bottom-bar-main {
    width: 100vw;
    margin-inline-start: 100vw;
    position: absolute;
    bottom: 0;
    inset-inline-end: auto;
  }

  html[dir="rtl"] .app-container,
  html[dir="rtl"] .bottom-bar {
    transform: none;
  }

  .dock-control-icon .bar-btn.vert {
    display: none;
  }

  .dock-control-icon {
    grid-template-columns: 1fr;
    width: 22px;
  }

  .chat-header,
  .write-area,
  .message-stream {
    padding-inline: 20px;
  }
}

.settings-delete-account {
  margin-top: 24px;
}

.settings-delete-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 8px 0 16px;
}

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

.otp-ok {
  border-color: #1a7f37 !important;
}

.otp-bad {
  border-color: var(--red-color) !important;
}
