:root {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  color: #132722;
  background: #eff4f2;
  --paper: #fff;
  --ink: #132722;
  --muted: #536861;
  --line: #dce7e3;
  --teal: #076b55;
  --teal-dark: #07513f;
  --selected: #e5f3ed;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, textarea, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #1d856c; outline-offset: 3px; }
h1, h2, p, ul, ol { margin: 0; }

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

.entry {
  display: grid;
  place-items: center;
  min-height: 100svh;
  padding: 24px;
  background: radial-gradient(ellipse at 24% 14%, #d9eee6 0%, transparent 54%), #eff4f2;
}

.login-card {
  width: min(100%, 430px);
  padding: 40px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 18px 65px #173f3320;
}

.brand-mark {
  position: relative;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--teal);
}

.brand-mark::before, .brand-mark::after {
  content: "";
  position: absolute;
  left: 11px;
  top: 11px;
  width: 18px;
  height: 13px;
  border: 1.5px solid #f5fffa;
  border-radius: 6px 6px 6px 2px;
}

.brand-mark::after {
  top: 20px;
  left: 17px;
  width: 14px;
  height: 9px;
  border-top-color: transparent;
  border-left-color: transparent;
  border-radius: 0 4px 2px 4px;
}

.brand-name {
  margin-bottom: 2px;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .08em;
  color: var(--teal-dark);
}

.login-card .brand-mark { margin-bottom: 18px; }
.login-card h1 { margin-bottom: 8px; font-size: clamp(24px, 5vw, 30px); }
.login-card form { display: grid; gap: 12px; margin-top: 28px; }
.login-card label { font-size: 14px; font-weight: 650; }
.login-card #registration-form { gap: 8px; margin-top: 20px; }

.login-card input {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  background: #f8faf9;
  border: 1px solid #b9cec6;
  border-radius: 9px;
}

.primary, .secondary, .text-button, .connection {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 650;
}

.primary { background: var(--teal); color: #fff; }
.primary:enabled:hover { background: var(--teal-dark); }
.primary:disabled { color: #546761; background: #e0e9e5; }
.secondary { background: var(--paper); border-color: #b9cec6; }
.secondary:enabled:hover, .text-button:enabled:hover { background: #eaf4ef; }
.text-button { background: transparent; color: var(--muted); }
.quiet { color: var(--muted); font-size: 13px; line-height: 1.55; }
.notice { color: #8b281c; background: #fff0eb; border-radius: 8px; padding: 8px 11px; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.notice-success { color: #145e48; background: #e5f3ed; }
#login-status { margin-top: 12px; }

.workspace {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  height: 100dvh;
  width: min(100%, 1680px);
  margin-inline: auto;
  padding: 15px 28px 24px;
}

.top-bar, .top-actions, .identity, .inbox-title-row, .chat-head, .composer-actions, .dialog-head {
  display: flex;
  align-items: center;
}

.top-bar { justify-content: space-between; gap: 16px; padding: 3px 1px 17px; }
.identity { min-width: 0; gap: 11px; }
.identity h1 { font-size: 20px; letter-spacing: -.02em; white-space: nowrap; }
.identity > div:last-child { min-width: 0; }
.workspace-account { max-width: 165px; margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { min-width: 0; gap: 9px; }

.instance {
  display: inline-block;
  max-width: min(18vw, 180px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.login-card .instance { max-width: 100%; }
.connection { display: inline-flex; align-items: center; gap: 8px; background: #fff; border-color: var(--line); white-space: nowrap; }
.connection:hover { border-color: #a8c8ba; }
.status-dot { border-radius: 50%; width: 8px; height: 8px; background: #828b89; }
.connection[data-state="connected"] .status-dot { background: #13835d; box-shadow: 0 0 0 3px #dff2e9; }
.connection[data-state="connecting"] .status-dot { background: #9e6a09; box-shadow: 0 0 0 3px #fff2d9; }
.connection[data-state="disconnected"] .status-dot { background: #af4837; box-shadow: 0 0 0 3px #fbeae6; }
.connection[data-state="paused"] .status-dot { background: #786c5a; }
.workspace-notice { grid-row: 2; margin-bottom: 8px; }

.desk {
  grid-row: 3;
  display: grid;
  grid-template-columns: clamp(246px, 26%, 326px) minmax(0, 1fr);
  position: relative;
  isolation: isolate;
  min-height: 0;
  border: 1px solid #d6e3de;
  border-radius: 20px;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 0 14px 40px #284a3e10;
}

.inbox { display: flex; flex-direction: column; min-height: 0; min-width: 0; border-right: 1px solid var(--line); }
.inbox-head { padding: 22px 20px 14px; border-bottom: 1px solid #edf2f0; }
.inbox-title-row { gap: 9px; margin-bottom: 13px; }
.inbox-title-row h2 { font-size: 19px; }
.batch-toggle { min-height: 31px; margin-inline-start: auto; padding: 3px 7px; font-size: 12px; white-space: nowrap; }
.batch-toggle[aria-expanded="true"] { color: var(--teal-dark); background: var(--selected); }
.batch-panel { display: grid; gap: 6px; margin-top: 9px; padding: 7px; border-radius: 8px; background: #f0f7f3; }
.batch-selection, .batch-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 9px; }
.batch-selection { justify-content: space-between; }
.batch-selection label { display: flex; align-items: center; gap: 4px; font-size: 12px; }
.batch-actions button { min-height: 32px; padding: 4px 7px; font-size: 12px; }
.batch-panel input, .conversation-select { width: 16px; height: 16px; margin: 0; accent-color: var(--teal); }
.conversation-row { display: flex; align-items: center; gap: 4px; }
.conversation-row .conversation-select { flex: 0 0 auto; margin-inline: 5px; }
.conversation-row .conversation { flex: 1 1 auto; min-width: 0; }
.total-unread, .unread { flex: 0 0 auto; border-radius: 999px; font-size: 11px; font-weight: 700; }
.total-unread { padding: 3px 7px; color: var(--teal-dark); background: #e1f2ea; }
.unread { min-width: 20px; padding: 3px 5px; text-align: center; color: #fff; background: var(--teal); }
.search-field { position: relative; display: block; }

.search-field input {
  width: 100%;
  min-height: 38px;
  padding: 8px 9px 8px 34px;
  font-size: 14px;
  background: #f1f6f4;
  border: 1px solid transparent;
  border-radius: 9px;
}

.search-icon { position: absolute; top: 12px; left: 12px; width: 11px; height: 11px; border: 1.5px solid var(--muted); border-radius: 50%; pointer-events: none; }
.search-icon::after { position: absolute; content: ""; width: 5px; height: 1.5px; top: 8px; left: 7px; transform: rotate(45deg); background: var(--muted); }
.inbox-channel-filter { display: block; margin-top: 7px; }
.inbox-channel-filter select { min-width: 0; width: 100%; min-height: 36px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--teal-dark); background: var(--paper); font: inherit; font-size: 13px; }
.inbox-filters { display: flex; gap: 6px; margin-top: 11px; }
.inbox-filters button { min-height: 32px; padding: 4px 8px; background: transparent; border: 1px solid transparent; border-radius: 7px; color: var(--muted); font-size: 12px; font-weight: 650; }
.inbox-head .inbox-filters { flex-wrap: wrap; gap: 3px; }
.inbox-head .inbox-filters button { white-space: nowrap; }
.inbox-filters button:hover { background: #f1f7f4; }
.inbox-filters button[aria-pressed="true"] { color: var(--teal-dark); background: var(--selected); border-color: #d8e9e0; }
.pending-count { margin-inline-start: 3px; font-variant-numeric: tabular-nums; }
.conversations, .messages { list-style: none; padding: 0; }
.conversations { overflow: auto; padding: 5px 8px 9px; }
.list-notice { padding: 15px 19px; }

.conversation {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 68px;
  padding: 10px 9px;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 10px;
}

.conversation:hover { background: #f1f7f4; }
.conversation[aria-current="true"] { background: var(--selected); }
.conversation:focus-visible { outline-offset: -2px; }
.chat-avatar, .avatar { display: grid; place-items: center; flex: 0 0 auto; width: 41px; height: 41px; border-radius: 12px; color: #134c3c; background: #dcedea; font-weight: 750; }
.conversation-info { display: grid; gap: 4px; flex: 1; min-width: 0; }
.conversation-line { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.conversation-flags { display: inline-flex; align-items: center; flex: 0 0 auto; gap: 4px; }
.pending-flag { padding: 2px 5px; border-radius: 5px; white-space: nowrap; color: #73500c; background: #fff0ce; font-size: 10px; font-weight: 650; }
.verification-flag { padding: 2px 5px; border-radius: 5px; white-space: nowrap; color: #6b4142; background: #f9e7e9; font-size: 10px; font-weight: 650; }
.conversation-title, .preview, .chat-head h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-title { font-size: 14px; font-weight: 700; }
.preview { font-size: 13px; color: var(--muted); }
.conversation-time { flex: 0 0 auto; white-space: nowrap; color: var(--muted); font-size: 11px; }
.channel-badge { display: inline-block; justify-self: start; max-width: 100%; padding: 2px 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--teal-dark); background: #ecf6f0; border-radius: 5px; font-size: 10px; font-weight: 650; }
.channel-badge[data-state="paused"], .channel-badge[data-state="disconnected"] { color: #63584f; background: #f1eeea; }

.chat { min-width: 0; min-height: 0; background: #f8fbf9; }
.empty-chat { display: grid; gap: 7px; justify-items: center; align-content: center; height: 100%; padding: 22px; text-align: center; }
.empty-chat h2 { font-size: 20px; }
.empty-chat p { color: var(--muted); font-size: 14px; }
.empty-chat button { margin-top: 8px; }
.empty-mark { position: relative; width: 66px; height: 66px; border: 1px solid #d5e8df; border-radius: 21px; margin-bottom: 9px; background: #e9f5ef; }
.empty-mark span { position: absolute; top: 19px; left: 15px; width: 27px; height: 17px; border: 2px solid #39836e; border-radius: 8px 8px 8px 3px; }
.empty-mark span + span { top: 29px; left: 30px; width: 21px; height: 14px; border-top-color: transparent; border-left-color: transparent; border-radius: 0 7px 3px 7px; }
.active-chat { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; height: 100%; }
.chat-head { grid-row: 1; gap: 11px; min-width: 0; min-height: 72px; padding: 12px 20px; background: #fff; border-bottom: 1px solid var(--line); }
.chat-identity { flex: 1 1 auto; min-width: 0; }
.chat-head h2 { font-size: 17px; }
.back-button { display: none; }
.chat-tools { display: flex; flex: 0 0 auto; align-items: center; gap: 5px; }
.chat-tools button { min-height: 36px; padding: 6px 10px; white-space: nowrap; }
.chat-tools button[aria-expanded="true"] { background: var(--selected); color: var(--teal-dark); }
.message-search-panel { grid-row: 2; display: grid; gap: 5px; padding: 10px 18px; background: var(--paper); border-bottom: 1px solid var(--line); }
.message-search-panel input { width: 100%; }

.message-area { grid-row: 3; display: flex; flex-direction: column; min-height: 0; overflow: auto; padding: 16px clamp(15px, 3.6vw, 44px); }
.message-area:focus-visible { outline-offset: -4px; }
.messages { display: flex; flex-direction: column; gap: 13px; margin-top: auto; }
.message { display: flex; flex-direction: column; align-items: flex-start; }
.message.outbound { align-items: flex-end; }
.bubble { max-width: min(85%, 580px); border: 1px solid #e0eae6; border-radius: 4px 14px 14px 14px; padding: 9px 13px; font-size: 14px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; background: #fff; }
.outbound .bubble { border-color: #d2e9dd; border-radius: 14px 4px 14px 14px; background: #dcf1e5; }
.bubble.media-bubble { width: min(85%, 252px); padding: 4px; }
.attachment-bubble { display: grid; gap: 8px; min-width: min(220px, 75%); }
.message-player { display: block; width: min(100%, 330px); max-height: 240px; }
.attachment-download { color: var(--teal-dark); overflow-wrap: anywhere; }
.media-caption { margin: 3px 4px; font-size: 13px; white-space: pre-wrap; }
.message-image { display: grid; place-items: center; width: 100%; height: auto; min-height: 88px; aspect-ratio: 4 / 3; padding: 0; overflow: hidden; border: 0; border-radius: 8px; background: #eef5f0; color: var(--muted); }
.message-image img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.message-image:focus-visible { outline-offset: -2px; }
.message-image:disabled { cursor: default; }
.bubble.video-bubble { width: min(85%, 330px); padding: 4px; }
.video-bubble > .attachment-download { margin: 0 5px 3px; font-size: 13px; }
.message-video { position: relative; display: grid; place-items: center; width: 100%; min-height: 88px; aspect-ratio: 16 / 9; padding: 0; overflow: hidden; border: 0; border-radius: 8px; background: var(--selected); color: var(--paper); }
.message-video:focus-visible { outline-offset: -2px; }
.message-video-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.message-video-play, .message-video-duration { position: absolute; display: grid; place-items: center; color: var(--paper); }
.message-video-play { width: 42px; height: 42px; padding-inline-start: 2px; border: 1px solid var(--paper); border-radius: 50%; background: var(--teal-dark); font-size: 17px; }
.message-video:hover .message-video-play { background: var(--teal); }
.message-video-duration { inset-inline-end: 6px; inset-block-end: 6px; padding: 1px 5px; border-radius: 4px; background: var(--ink); font-size: 11px; font-variant-numeric: tabular-nums; }
.message-meta { display: flex; flex-wrap: wrap; gap: 5px 8px; margin-top: 4px; padding-inline: 1px; color: var(--muted); font-size: 11px; }
.outbound .message-meta { justify-content: flex-end; }
.message-meta [data-status="failed"], .message-meta [data-status="unknown"] { color: #923225; }
.delivery-action { margin: 0; padding: 2px 6px; color: var(--teal-dark); background: #edf6f0; border: 1px solid #bed6ca; border-radius: 5px; font-size: 11px; font-weight: 650; }
.delivery-action:enabled:hover { background: var(--selected); }
.delivery-action:disabled { opacity: .65; }
.history-match .bubble, .bubble.history-match { border-color: #9fb9a5; box-shadow: 0 0 0 2px #e6f1e8; }
mark.history-match { padding: 0 1px; color: var(--ink); background: #f4e1a5; border-radius: 2px; }
.messages-notice { text-align: center; }

.composer { grid-row: 4; min-width: 0; display: grid; gap: 8px; padding: 12px 18px; background: #fff; border-top: 1px solid var(--line); }
.composer textarea { min-height: 53px; max-height: 24dvh; width: 100%; min-width: 0; padding: 8px 10px; resize: vertical; background: #f7faf8; border: 1px solid #c8dad3; border-radius: 9px; line-height: 1.45; }
.composer textarea::placeholder { color: #687b75; }
.composer textarea:disabled { background: #f2f5f4; }
.composer-actions { justify-content: space-between; gap: 9px; }
.composer-actions .primary { min-width: 82px; }
.composer-attachments { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.composer-attachments button { min-height: 31px; padding: 3px 8px; font-size: 12px; }
.composer-attachments [aria-expanded="true"] { color: var(--teal-dark); background: var(--selected); }
.sticker-panel { max-height: min(23dvh, 158px); padding: 6px; overflow: auto; border: 1px solid var(--line); border-radius: 9px; background: #f7faf8; }
.sticker-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(52px, 1fr)); gap: 4px; }
.sticker-card { min-width: 0; display: grid; justify-items: center; gap: 2px; padding: 3px; border: 1px solid transparent; border-radius: 7px; background: transparent; }
.sticker-card:hover { border-color: #c1dacd; background: #edf6ef; }
.sticker-card img { display: block; width: min(100%, 52px); height: auto; aspect-ratio: 1; }
.sticker-card span { font-size: 11px; white-space: nowrap; }
.sticker-card:focus-visible { outline-offset: -2px; }
.image-preview { min-width: 0; display: flex; align-items: center; gap: 8px; padding: 6px; border: 1px solid #c9ded3; border-radius: 9px; background: #eff7f2; }
.image-preview img { flex: 0 0 auto; width: 68px; height: 54px; border-radius: 6px; object-fit: contain; background: #dcece3; }
.image-preview-details { min-width: 0; flex: 1 1 auto; }
.image-preview-details p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.image-preview-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 3px; }
.image-preview-actions button { min-height: 34px; padding: 4px 7px; white-space: nowrap; font-size: 12px; }
.voice-panel { min-width: 0; display: grid; gap: 5px; padding: 7px 9px; border: 1px solid #c9ded3; border-radius: 9px; background: #eff7f2; }
.voice-status-row, .voice-actions { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.voice-status-row [role="status"] { color: var(--teal-dark); font-weight: 650; }
#voice-clock { flex: 0 0 auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
#voice-preview { display: block; width: 100%; max-width: 100%; height: 40px; }
.voice-actions { justify-content: flex-end; flex-wrap: wrap; }
.voice-actions button { min-height: 34px; padding: 4px 8px; font-size: 12px; }

.contact-panel { min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 16px; background: #fff; border-left: 1px solid var(--line); }
.contact-panel:focus-visible { outline-offset: -3px; }
.contact-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 0 0 12px; border-bottom: 1px solid var(--line); }
.contact-head h2 { margin-top: 5px; font-size: 17px; }
.contact-head .quiet { margin-top: 3px; }
.contact-head button { flex: 0 0 auto; }
.contact-form { display: grid; gap: 7px; padding-block: 14px; }
.contact-form label { margin-top: 5px; font-size: 13px; font-weight: 650; }
.contact-form input, .contact-form textarea { min-width: 0; width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid #b9cec6; border-radius: 8px; background: #f8faf9; line-height: 1.45; }
.contact-form textarea { resize: vertical; }
.contact-form button { justify-self: end; margin-top: 4px; }
.contact-actions { display: flex; justify-content: flex-end; padding-top: 12px; border-top: 1px solid var(--line); }

@media (min-width: 1120px) {
  .desk.contact-open { grid-template-columns: clamp(246px, 25%, 316px) minmax(0, 1fr) clamp(238px, 22%, 302px); }
}

@media (max-width: 1119px) {
  .contact-panel { position: absolute; z-index: 2; inset-block: 0; inset-inline-end: 0; width: min(100%, 360px); box-shadow: -10px 0 28px #173f3320; }
}

dialog { width: min(calc(100vw - 28px), 410px); padding: 22px; border: 1px solid var(--line); border-radius: 19px; color: var(--ink); box-shadow: 0 18px 70px #173f3340; }
dialog::backdrop { background: #182f2860; }
.media-dialog { width: min(calc(100vw - 28px), 820px); max-height: calc(100dvh - 28px); }
.media-dialog img { display: block; max-width: 100%; max-height: 73dvh; margin-inline: auto; object-fit: contain; }
.media-dialog[data-media-type="video"] { width: min(calc(100vw - 28px), 940px); }
.media-dialog-stage { position: relative; display: grid; place-items: center; min-height: 60px; }
.media-dialog-stage video { display: block; width: 100%; min-height: 95px; max-height: min(69dvh, calc(100dvh - 125px)); aspect-ratio: 16 / 9; border-radius: 8px; background: var(--ink); object-fit: contain; }
.media-dialog-status { position: absolute; z-index: 1; max-width: calc(100% - 16px); margin: 0; padding: 5px 9px; border-radius: 6px; background: var(--paper); text-align: center; pointer-events: none; }
.media-dialog-footer { display: flex; justify-content: flex-end; margin-top: 10px; font-size: 14px; }
.quick-replies-dialog { width: min(calc(100vw - 28px), 540px); max-height: calc(100dvh - 28px); }
.quick-replies-dialog .notice { margin: 7px 0; }
.quick-replies-list { display: grid; gap: 5px; max-height: 190px; overflow-y: auto; padding: 3px; list-style: none; }
.quick-reply-row { display: flex; justify-content: space-between; align-items: center; gap: 7px; padding: 7px; border: 1px solid var(--line); border-radius: 8px; }
.quick-reply-row > div:first-child { min-width: 0; overflow-wrap: anywhere; }
.quick-reply-content { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; white-space: pre-wrap; }
.quick-reply-row strong { font-size: 13px; }
.quick-reply-row .quick-reply-actions { flex: 0 0 auto; }
.quick-reply-form { display: grid; gap: 5px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.quick-reply-form-head, .quick-reply-actions { display: flex; justify-content: space-between; align-items: center; gap: 4px; }
.quick-reply-actions { justify-content: flex-end; }
.quick-reply-form h3 { margin: 0; font-size: 15px; }
.quick-reply-form label { margin-top: 3px; font-size: 13px; font-weight: 650; }
.quick-reply-form input, .quick-reply-form textarea { min-width: 0; width: 100%; padding: 8px; border: 1px solid #b9cec6; border-radius: 8px; background: #f8faf9; }
.quick-reply-form textarea { max-height: 22dvh; resize: vertical; }
.quick-reply-row button { min-height: 31px; padding: 3px 7px; font-size: 12px; }
.dialog-head { justify-content: space-between; margin-bottom: 8px; }
.dialog-head h2 { font-size: 20px; }
.close-button { font-size: 22px; line-height: 1; }
.connection-summary { padding-block: 10px; }
.connection-summary p { overflow-wrap: anywhere; }
.channels-dialog { width: min(calc(100vw - 28px), 670px); max-height: calc(100dvh - 28px); overflow-y: auto; }
.channels-dialog > .notice { margin-bottom: 10px; }
.channels-layout { display: grid; grid-template-columns: minmax(0, 230px) minmax(0, 1fr); gap: 16px; }
.channels-directory, .channel-target-panel { min-width: 0; }
.channel-target-panel { padding-left: 16px; border-left: 1px solid var(--line); }
.channel-target-panel .connection-summary { padding-top: 0; }
.channel-target-panel h3 { margin: 0 0 4px; overflow-wrap: anywhere; font-size: 17px; }
.channel-list { display: grid; gap: 5px; max-height: 230px; overflow-y: auto; padding: 0 2px 2px; list-style: none; }
.channel-row { display: flex; align-items: center; justify-content: space-between; gap: 7px; width: 100%; min-height: 42px; padding: 7px 8px; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.channel-row:hover, .channel-row[aria-current="true"] { background: var(--selected); }
.channel-row:focus-visible { outline-offset: -2px; }
.channel-row strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.channel-state { flex: 0 0 auto; color: var(--muted); font-size: 11px; }
.channel-state[data-state="connected"] { color: var(--teal-dark); }
.channel-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px; align-items: end; margin-top: 8px; }
.channel-form label { grid-column: 1 / -1; font-size: 13px; font-weight: 650; }
.channel-form input { min-width: 0; width: 100%; height: 40px; padding: 7px 8px; border: 1px solid #b9cec6; border-radius: 8px; background: #f8faf9; }
.channel-actions { flex-wrap: wrap; margin-block: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 15px; }
.delivery-dialog-actions { flex-wrap: wrap; }
#delivery-error { margin-top: 10px; }
.qr-view { display: grid; justify-items: center; gap: 10px; padding: 14px 10px; text-align: center; background: #f3f8f5; border-radius: 12px; color: var(--muted); font-size: 14px; }
.qr-view img { max-width: 100%; height: auto; background: white; border: 6px solid white; border-radius: 6px; image-rendering: pixelated; }
.verify-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; margin-top: 13px; }
.verify-form label { grid-column: 1 / -1; font-size: 13px; font-weight: 650; }
.verify-form input { min-width: 0; height: 40px; padding: 8px 10px; border: 1px solid #b9cec6; border-radius: 9px; background: #f8faf9; }
.team-dialog { width: min(calc(100vw - 28px), 530px); max-height: min(760px, calc(100dvh - 28px)); overflow-y: auto; }
.team-dialog #team-error { margin-block: 8px; }
.team-dialog #team-retry { margin-top: 7px; }
.team-form, .security-form { display: grid; gap: 6px; margin-top: 12px; }
.team-form label, .security-form label { margin-top: 4px; font-size: 13px; font-weight: 650; }
.team-form input, .security-form input { min-width: 0; width: 100%; height: 40px; padding: 8px 10px; border: 1px solid #b9cec6; border-radius: 9px; background: #f8faf9; }
.team-form > .primary, .security-form > .primary { justify-self: end; margin-top: 7px; }
.security-dialog { max-height: calc(100dvh - 28px); }
.security-modes { margin-top: 0; }
.security-dialog .notice { margin-top: 10px; }
#security-owner-code-field { margin-top: 0; }
.team-form h3 { margin: 0; font-size: 16px; }
.team-create { padding-top: 13px; border-top: 1px solid var(--line); }
.team-tabs { margin: 8px 0 12px; }
.member-list { display: grid; gap: 6px; padding: 0; list-style: none; }
.team-panel .member-list { max-height: 235px; overflow-y: auto; }
.member-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; }
.member-row > div { min-width: 0; }
.member-row strong, .member-row p { overflow-wrap: anywhere; }
.member-row button { flex: 0 0 auto; min-height: 32px; padding: 5px 8px; font-size: 12px; }
.member-row button:disabled { opacity: .65; }
.team-invites { display: grid; gap: 11px; }
.invite-create { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.invite-create > div { flex: 1 0 90px; display: grid; gap: 4px; }
.invite-create label, .invite-copy-row label { font-size: 13px; font-weight: 650; }
.member-password-actions button { min-height: 35px; font-size: 13px; }
.invite-create select, .invite-create input, .invite-copy-row input { min-width: 0; width: 100%; min-height: 40px; padding: 7px 9px; border: 1px solid #b9cec6; border-radius: 8px; font: inherit; color: var(--ink); background: #f8faf9; }
.invite-result { display: grid; gap: 8px; padding: 11px; border-radius: 10px; background: #e5f3ed; }
.invite-copy-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 6px; }
.invite-copy-row label { grid-column: 1 / -1; }
.invite-copy-row input { font-size: 13px; }
.invite-copy-row button { padding-inline: 8px; font-size: 12px; }
.invite-record-status { font-size: 13px; }
.invite-record-status[data-status="active"] { color: var(--teal-dark); }
.invite-record-status[data-status="exhausted"] { color: #765819; }
.invite-usage { font-variant-numeric: tabular-nums; }

@media (max-width: 760px) {
  .workspace { padding: max(7px, env(safe-area-inset-top)) 0 0; }
  .top-bar { gap: 7px; padding: 3px 9px 9px; }
  .identity { gap: 5px; }
  .identity .brand-mark { display: none; }
  .identity h1 { font-size: 15px; }
  .workspace-account { max-width: 112px; }
  .identity .brand-name, .instance { font-size: 11px; }
  .top-actions { flex-wrap: wrap; justify-content: flex-end; gap: 3px; }
  .top-actions button { min-height: 36px; padding-inline: 6px; font-size: 12px; }
  .top-actions .connection { gap: 6px; }
  .top-actions .instance { max-width: 80px; }
  .desk { grid-template-columns: minmax(0, 1fr); border-radius: 0; border-inline: 0; }
  .inbox { border-right: 0; }
  .inbox-head { padding: 14px 12px 10px; }
  .desk:not(.has-selection) .chat, .desk.has-selection .inbox { display: none; }
  .chat-head { min-height: 57px; padding: 7px 10px; }
  .chat-head .chat-avatar { width: 35px; height: 35px; }
  .chat-head .chat-identity .quiet { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chat-tools { gap: 2px; }
  .chat-tools button { padding-inline: 7px; font-size: 12px; }
  .message-search-panel { padding: 7px 10px; }
  .message-search-panel input, .contact-form input, .contact-form textarea { font-size: 16px; }
  .quick-reply-form input, .quick-reply-form textarea { font-size: 16px; }
  .channel-form input, .inbox-channel-filter select { font-size: 16px; }
  .desk.contact-open .chat { visibility: hidden; }
  .contact-panel { width: 100%; border-left: 0; box-shadow: none; padding: 12px 16px max(16px, env(safe-area-inset-bottom)); }
  .back-button { display: block; padding-inline: 11px; }
  .composer { padding: 7px 10px max(7px, env(safe-area-inset-bottom)); }
  .composer textarea { font-size: 16px; }
  .team-form input, .security-form input, .login-card input { font-size: 16px; }
  .workspace-notice { margin-inline: 8px; }
}

@media (max-width: 540px) {
  .channels-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .channel-target-panel { padding: 12px 0 0; border: 0; border-top: 1px solid var(--line); }
  .channel-list { max-height: 142px; }
}

@media (max-width: 400px) {
  .login-card { padding: 25px; }
  .top-actions .instance { flex-basis: 100%; max-width: 100%; text-align: right; }
}
