:root {
  color-scheme: dark;
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  --bg: #181818;
  --surface-1: #1e1e1f;
  --surface-2: #212121;
  --surface-3: #282828;
  --surface-4: #303030;
  --hover: rgba(255, 255, 255, 0.06);
  --selected: #2a2a2a;
  --border: rgba(255, 255, 255, 0.08);
  --border-soft: rgba(255, 255, 255, 0.04);
  --text: #f5f5f5;
  --text-soft: #a6a6a6;
  --muted: #8a8a8a;
  --muted-2: #8a8a8a;
  --blue: #339cff;
  --blue-hover: #5aafff;
  --blue-soft: rgba(51, 156, 255, 0.14);
  --success: #45c98c;
  --success-soft: rgba(69, 201, 140, 0.13);
  --warning: #e9a84a;
  --warning-soft: rgba(233, 168, 74, 0.13);
  --danger: #e16569;
  --danger-soft: rgba(225, 101, 105, 0.13);
  --focus: #79aaff;
  --conversation-width: 336px;
  --scenario-collapsed-width: 44px;
  --scenario-open-width: 332px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  min-width: 1180px;
  min-height: 680px;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

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

button,
input,
textarea,
select,
summary {
  letter-spacing: 0;
}

button {
  color: inherit;
}

button:not(:disabled),
summary,
label:has(input:not(:disabled)) {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
}

button,
input,
textarea,
select {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

::selection {
  background: rgba(51, 156, 255, 0.34);
  color: #fff;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 8px;
  background: #35404b;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: #465361;
  background-clip: padding-box;
}

[hidden] {
  display: none !important;
}

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

.app-shell {
  display: grid;
  grid-template-columns: var(--conversation-width) minmax(0, 1fr) auto;
  grid-template-rows: minmax(0, 1fr);
  width: 100%;
  height: 100vh;
  background: var(--bg);
  overflow: hidden;
}

.conversation-pane {
  display: grid;
  grid-template-rows: 66px minmax(0, 1fr);
  min-width: 0;
  border-right: 1px solid var(--border);
  background: var(--surface-1);
}

.entry-tabs {
  display: grid;
  grid-template-columns: max-content max-content max-content 1fr;
  align-items: stretch;
  gap: 20px;
  min-width: 0;
  min-height: 48px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
}

.entry-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: var(--figma-control-height, 36px);
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.entry-tab:hover {
  color: var(--text-soft);
}

.entry-tab.is-active,
.entry-tab[aria-selected="true"] {
  color: #65a0ff;
  font-weight: 600;
}

.entry-tab.is-active::after,
.entry-tab[aria-selected="true"]::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--blue);
  content: "";
}

.entry-badge {
  display: inline-grid;
  min-width: 32px;
  height: 20px;
  place-items: center;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  line-height: 20px;
}

.icon-button {
  display: inline-grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
}

.icon-button:hover:not(:disabled) {
  background: var(--hover);
  color: var(--text);
}

.icon-button:active:not(:disabled) {
  background: var(--selected);
}

.entry-add {
  justify-self: end;
  align-self: center;
  font-size: 26px;
  font-weight: 300;
}

.sidebar-section {
  display: grid;
  grid-template-rows: minmax(0, 1fr) 56px;
  min-height: 0;
}

.sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px 0 20px;
}

.sidebar-heading > div {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 9px;
}

.sidebar-heading h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
}

.sidebar-heading span {
  color: var(--muted-2);
  font-size: 12px;
}

.subtle-button {
  color: var(--muted);
  font-size: 22px;
}

.sidebar-content {
  min-height: 0;
  overflow-y: auto;
  padding: 10px 8px 12px;
}

.sidebar-content > .sidebar-search {
  margin: 0 2px 8px;
}

.group-list,
.conversation-list,
.contact-list {
  display: grid;
  gap: 0;
}

.group-list .conversation-row {
  grid-template-columns: 48px minmax(0, 1fr);
}

.contact-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 7px 9px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  text-align: left;
}

.contact-row:hover {
  background: var(--hover);
}

.contact-row > span:last-child {
  display: grid;
  min-width: 0;
  gap: 4px;
}

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

.contact-row strong {
  font-size: 12px;
  font-weight: 550;
}

.contact-row small,
.empty-copy {
  color: var(--muted);
  font-size: 12px;
}

.empty-copy {
  margin: 40px 12px;
  text-align: center;
}

.conversation-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 64px;
  padding: 8px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: left;
}

.conversation-row:hover {
  background: var(--hover);
}

.conversation-row.is-active,
.conversation-row[aria-current="true"] {
  background: var(--selected);
}

.conversation-row:active {
  background: #29333e;
}

.group-avatar,
.avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  color: #fff;
  font-weight: 650;
  user-select: none;
}

.group-avatar {
  width: 46px;
  height: 46px;
  background: #35404d;
  font-size: 13px;
}

.group-avatar.has-image,
.avatar.has-image {
  background: #1b222b;
  border-color: rgba(255, 255, 255, 0.14);
}

.group-avatar img,
.avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.group-avatar-four {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 1px;
  padding: 2px;
  background: #27313b;
}

.group-avatar-four i {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  border-radius: 50%;
  background: #42516a;
  color: #f7f9fb;
  font-size: 12px;
  font-style: normal;
}

.group-avatar-four i:nth-child(2) {
  background: #706052;
}

.group-avatar-four i:nth-child(3) {
  background: #47564e;
}

.group-avatar-four i:nth-child(4) {
  background: #66515c;
}

.avatar-warm i:nth-child(1),
.avatar-warm i:nth-child(4) {
  background: #755c46;
}

.avatar-rose i:nth-child(2),
.avatar-rose i:nth-child(3) {
  background: #6a4955;
}

.avatar-cool i:nth-child(1),
.avatar-cool i:nth-child(3) {
  background: #3d5f70;
}

.avatar-green i:nth-child(2),
.avatar-green i:nth-child(4) {
  background: #3f6555;
}

.avatar-brand {
  background: #2464c6;
  font-size: 18px;
}

.avatar-code {
  background: #374353;
  font-size: 15px;
}

.avatar-photo {
  background: #6d4f60;
  font-size: 15px;
}

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

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

.conversation-copy strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 550;
}

.conversation-copy small {
  color: var(--muted);
  font-size: 12px;
}

.mention-mark {
  color: var(--warning);
}

.conversation-meta {
  display: grid;
  align-self: stretch;
  justify-items: end;
  align-content: center;
  gap: 7px;
  color: var(--muted-2);
  font-size: 12px;
}

.conversation-meta b {
  display: grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  font-weight: 650;
}

.sidebar-footer {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border-top: 1px solid var(--border-soft);
}

.sidebar-search,
.drawer-search,
.dialog-search {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

.sidebar-search input,
.drawer-search input,
.dialog-search input,
.large-search input {
  width: 100%;
  height: 36px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--text);
}

.sidebar-search input,
.drawer-search input,
.dialog-search input {
  padding: 0 12px 0 36px;
}

.sidebar-search input::placeholder,
.drawer-search input::placeholder,
.dialog-search input::placeholder,
.large-search input::placeholder,
textarea::placeholder {
  color: var(--muted-2);
}

.sidebar-search input:focus,
.drawer-search input:focus,
.dialog-search input:focus,
.large-search input:focus,
.field-label input:focus,
.announcement-form textarea:focus {
  border-color: var(--blue);
  background: #1d2530;
}

.search-icon {
  position: absolute;
  z-index: 1;
  left: 13px;
  width: 13px;
  height: 13px;
  border: 1.5px solid var(--muted);
  border-radius: 50%;
  pointer-events: none;
}

.search-icon::after {
  position: absolute;
  right: -4px;
  bottom: -3px;
  width: 5px;
  height: 1.5px;
  transform: rotate(45deg);
  transform-origin: left center;
  background: var(--muted);
  content: "";
}

.workspace {
  min-width: 0;
  min-height: 0;
  background: var(--bg);
}

.group-chat {
  display: grid;
  grid-template-areas:
    "header"
    "announcement"
    "notices"
    "messages"
    "typing"
    "composer";
  grid-template-rows: 86px auto auto minmax(0, 1fr) auto auto;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.chat-header {
  grid-area: header;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-width: 0;
  padding: 0 26px 0 30px;
  border-bottom: 1px solid var(--border);
  background: rgba(16, 21, 27, 0.82);
}

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

.heading-line {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
}

.group-heading h1,
.state-header h1 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 17px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-heading p,
.state-header p {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.status-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border: 2px solid var(--success);
  border-radius: 50%;
}

.role-chip,
.status-chip,
.message-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 4px;
  background: var(--blue-soft);
  color: #7dadff;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

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

.header-action {
  display: inline-flex;
  height: var(--figma-control-height, 36px);
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-soft);
}

.header-action:hover {
  background: var(--hover);
  color: var(--text);
}

.header-action:active {
  background: var(--selected);
}

.header-more {
  width: var(--figma-control-height, 36px);
  margin-left: 2px;
  font-size: 16px;
}

.folder-icon {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 14px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}

.folder-icon::before {
  position: absolute;
  top: -4px;
  left: 1px;
  width: 7px;
  height: 4px;
  border: 1.5px solid currentColor;
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
  content: "";
}

.person-add-icon {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 17px;
}

.person-add-icon::before {
  position: absolute;
  top: 0;
  left: 2px;
  width: 6px;
  height: 6px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  content: "";
}

.person-add-icon::after {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 11px;
  height: 7px;
  border: 1.5px solid currentColor;
  border-radius: 7px 7px 2px 2px;
  content: "";
}

.person-add-icon + span::before {
  position: absolute;
}

.announcement-strip {
  grid-area: announcement;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto 16px;
  align-items: center;
  gap: 10px;
  width: calc(100% - 48px);
  min-height: 48px;
  margin: 12px 24px 0;
  padding: 7px 12px;
  border: 1px solid #29394d;
  border-radius: 6px;
  background: #141d28;
  text-align: left;
}

.announcement-strip:hover {
  border-color: #34557f;
  background: #172232;
}

.announcement-strip > div {
  display: grid;
  grid-column: 1 / 4;
  min-width: 0;
  gap: 3px;
}

.announcement-strip > div strong {
  font-size: 12px;
  font-weight: 600;
}

.announcement-strip > div span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.announcement-strip > button {
  grid-column: 4;
  min-height: 28px;
  padding: 0 8px;
  border: 0;
  border-radius: 4px;
  background: var(--blue-soft);
  color: #78aaff;
  font-size: 12px;
}

.announcement-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 5px;
  background: var(--blue-soft);
  color: #78aaff;
  font-size: 12px;
  font-weight: 700;
}

.announcement-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.announcement-copy strong {
  font-size: 12px;
  font-weight: 600;
}

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

.announcement-state {
  color: #77a8fb;
  font-size: 12px;
}

.chevron {
  color: var(--muted);
  font-size: 20px;
}

.chat-notice-region {
  grid-area: notices;
  min-height: 0;
}

.locator-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  margin: 8px auto 0;
  padding: 0 11px;
  border: 1px solid #2a3b50;
  border-radius: 5px;
  background: #151f2b;
  color: var(--text-soft);
  font-size: 12px;
}

.locator-bar:hover {
  background: #192536;
}

.locator-bar > span:last-child {
  margin-left: 6px;
  color: #76a8ff;
}

.locator-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
}

.inline-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  margin: 8px 24px 0;
  padding: 7px 11px;
  border: 1px solid;
  border-radius: 5px;
  font-size: 12px;
}

.inline-notice strong {
  white-space: nowrap;
}

.inline-notice span {
  color: var(--muted);
}

.inline-notice.is-warning {
  border-color: rgba(233, 168, 74, 0.35);
  background: var(--warning-soft);
  color: #efb865;
}

.inline-notice.is-danger {
  border-color: rgba(225, 101, 105, 0.35);
  background: var(--danger-soft);
  color: #ee8689;
}

.message-list {
  grid-area: messages;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 22px 30px 30px;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
  scroll-behavior: smooth;
}

.new-message-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin: 8px 0 14px;
  color: #788494;
  font-size: 12px;
}

.new-message-divider::before,
.new-message-divider::after {
  height: 1px;
  background: #29313c;
  content: "";
}

.system-message {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 2px 0 20px;
  color: var(--muted-2);
  font-size: 12px;
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-width: 0;
  margin-bottom: 20px;
}

.message.is-self {
  flex-direction: row-reverse;
}

.avatar {
  width: 38px;
  height: 38px;
  font-size: 13px;
}

.avatar-blue {
  background: #356aa1;
}

.avatar-amber {
  background: #84633d;
}

.avatar-slate {
  background: #4c5868;
}

.avatar-cyan {
  background: #36717d;
}

.avatar-violet {
  background: #6d5f8f;
}

.avatar-green {
  background: #4a735e;
}

.avatar-rose {
  background: #7f5462;
}

.message-body {
  display: grid;
  min-width: 0;
  max-width: min(620px, 72%);
  gap: 6px;
}

.message.is-self .message-body {
  justify-items: end;
}

.message-body > header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 17px;
  color: var(--muted);
  font-size: 12px;
}

.message.is-self .message-body > header {
  flex-direction: row-reverse;
}

.message-body > header strong {
  color: var(--muted);
  font-weight: 500;
}

.message-body > p {
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 10px 13px;
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--text);
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.message.is-self .message-body > p {
  background: var(--blue);
  color: #fff;
}

.message.is-mentioned .message-body > p {
  outline: 1px solid rgba(51, 156, 255, 0.5);
  outline-offset: 1px;
}

.message-body mark {
  background: transparent;
  color: #78aaff;
}

.message.is-self .message-body mark {
  color: #fff;
  font-weight: 650;
}

.message-tag {
  height: 18px;
  padding: 0 5px;
}

.receipt {
  color: var(--muted-2);
  font-size: 12px;
}

.reply-link {
  justify-self: start;
  padding: 0;
  border: 0;
  background: transparent;
  color: #72a4fb;
  font-size: 12px;
}

.message.is-self .reply-link {
  justify-self: end;
}

.resource-record {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 6px 12px;
  width: min(400px, 100%);
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-3);
}

.resource-record__type {
  display: grid;
  grid-row: 1 / span 2;
  width: 40px;
  height: 48px;
  place-items: center;
  border-radius: 6px;
  background: var(--selected);
  color: var(--accent-bright);
  font-size: 12px;
  font-weight: 600;
}

.resource-record__copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.resource-record__copy strong,
.resource-record__meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-record__copy strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.resource-record__meta,
.resource-record__state {
  color: var(--muted);
  font-size: 12px;
}

.resource-record__state {
  grid-column: 2;
}

.resource-record__actions {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr) auto;
  min-width: 0;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
}

.resource-record__actions button {
  min-height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.resource-record__actions .resource-primary-action {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.resource-record.is-unavailable .resource-record__state {
  color: var(--danger);
}

.file-message {
  width: min(360px, 100%);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-3);
}

.file-message:has(> nav) {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px 12px 0;
}

.file-message > div:not(.file-summary) {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.file-message > div:not(.file-summary) strong,
.file-message > div:not(.file-summary) span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-message > div:not(.file-summary) strong {
  font-size: 12px;
  font-weight: 550;
}

.file-message > div:not(.file-summary) span {
  color: var(--muted);
  font-size: 12px;
}

.file-message > nav {
  display: flex;
  grid-column: 1 / -1;
  min-height: 36px;
  align-items: center;
  gap: 4px;
  margin: 0 -12px;
  padding: 0 10px;
  border-top: 1px solid var(--border);
}

.file-message > nav button {
  min-height: 27px;
  padding: 0 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #62a0ff;
  font-size: 12px;
}

.file-message > nav button:hover {
  background: var(--hover);
}

.file-summary {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  padding: 13px;
}

.file-summary > span:last-child {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.file-summary strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-summary small {
  color: var(--muted);
  font-size: 12px;
}

.file-type {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 48px;
  place-items: center;
  border-radius: 4px;
  background: #256fd2;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.file-message > footer {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: 2px;
  padding: 0 8px;
  border-top: 1px solid var(--border);
}

.file-message > footer button {
  min-height: 28px;
  padding: 0 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #62a0ff;
  font-size: 12px;
}

.file-message > footer button:hover {
  background: var(--hover);
}

.file-message > footer .icon-button {
  margin-left: auto;
  color: var(--muted);
}

.retry-message {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #ef8e91;
  font-size: 12px;
}

.retry-message > span {
  display: grid;
  width: 15px;
  height: 15px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 12px;
}

.typing-indicator {
  grid-area: typing;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  padding: 0 30px;
  color: var(--muted);
  font-size: 12px;
}

.typing-indicator > span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--muted);
}

.composer {
  grid-area: composer;
  display: grid;
  grid-template-rows: auto 32px minmax(58px, auto) 42px;
  min-height: 148px;
  margin: 0 26px 20px;
  border-top: 1px solid var(--border);
}

.reply-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  margin-top: 8px;
  padding: 7px 9px 7px 11px;
  border-left: 2px solid var(--blue);
  background: var(--surface-2);
}

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

.reply-preview strong {
  font-size: 12px;
}

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

.composer-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-top: 7px;
}

.composer-tools .icon-button {
  width: 32px;
  height: 28px;
  font-size: 16px;
}

.emoji-icon {
  font-size: 18px;
}

.image-icon {
  position: relative;
  width: 17px;
  height: 14px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}

.image-icon::before {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.image-icon::after {
  position: absolute;
  right: 2px;
  bottom: 2px;
  left: 2px;
  height: 6px;
  border-left: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: skew(-30deg);
  content: "";
}

.composer textarea {
  width: 100%;
  min-height: 58px;
  padding: 8px 2px;
  resize: none;
  border: 0;
  background: transparent;
  color: var(--text);
  line-height: 1.6;
}

.composer.is-disabled {
  opacity: 0.78;
}

.composer-lock {
  grid-column: 1 / -1;
  margin: 0;
  padding: 7px 10px;
  border-radius: 4px;
  background: var(--warning-soft);
  color: #efb865;
  font-size: 12px;
}

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

.composer-footer > span {
  color: var(--muted-2);
  font-size: 12px;
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 36px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 5px;
  font-weight: 550;
  white-space: nowrap;
}

.primary-button {
  background: var(--blue);
  color: #fff;
}

.primary-button:hover:not(:disabled) {
  background: var(--blue-hover);
}

.primary-button:active:not(:disabled) {
  background: #2868d0;
}

.primary-button:disabled {
  background: #2b405f;
  color: #778ba8;
}

.secondary-button {
  border-color: var(--border);
  background: var(--surface-3);
  color: var(--text-soft);
}

.secondary-button:hover:not(:disabled) {
  border-color: #3a4653;
  background: var(--surface-4);
}

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

.danger-button:hover {
  background: #ee7478;
}

.send-button {
  min-width: 94px;
  min-height: 38px;
}

.muted-composer {
  grid-area: composer;
  display: flex;
  min-height: 92px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0 26px 20px;
  border-top: 1px solid var(--border);
  color: var(--text-soft);
}

.muted-composer > div {
  display: grid;
  gap: 4px;
}

.muted-composer strong {
  color: var(--text-soft);
  font-size: 13px;
}

.muted-composer span {
  font-size: 12px;
}

.mute-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 12px;
  font-weight: 700;
}

.workspace-state {
  width: 100%;
  height: 100%;
  min-width: 0;
  background: var(--bg);
}

.state-header {
  display: flex;
  height: 86px;
  align-items: center;
  gap: 12px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-1);
}

.state-header > div {
  min-width: 0;
}

.state-content {
  width: min(760px, calc(100% - 56px));
  margin: 54px auto 0;
}

.large-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.large-search input {
  height: 42px;
  padding: 0 13px;
  border-color: var(--border);
}

.group-search-results {
  margin-top: 20px;
}

.group-result {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 82px;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
}

.group-result > div {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.group-result > div strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-result > div span {
  color: var(--muted);
  font-size: 12px;
}

.empty-state {
  display: grid;
  justify-items: center;
  width: min(460px, calc(100% - 48px));
  margin: 18vh auto 0;
  text-align: center;
}

.state-content .empty-state {
  margin-top: 84px;
}

.empty-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  margin-bottom: 16px;
  border: 1px solid #33445c;
  border-radius: 50%;
  background: #162030;
  color: #77a9ff;
  font-size: 22px;
  font-weight: 650;
}

.empty-icon.is-danger {
  border-color: rgba(225, 101, 105, 0.36);
  background: var(--danger-soft);
  color: var(--danger);
}

.empty-state h1,
.empty-state h2 {
  margin: 0;
  font-size: 18px;
}

.empty-state p {
  margin: 9px 0 20px;
  color: var(--muted);
  line-height: 1.6;
}

.scenario-console {
  position: relative;
  z-index: 20;
  width: var(--scenario-collapsed-width);
  min-width: var(--scenario-collapsed-width);
  height: 100%;
  border-left: 1px solid var(--border);
  background: var(--surface-1);
}

.scenario-console.is-open,
.scenario-console:not(.is-collapsed),
.scenario-console[data-state="open"] {
  width: var(--scenario-open-width);
  min-width: var(--scenario-open-width);
}

.scenario-handle {
  display: grid;
  width: 100%;
  height: 100%;
  align-content: center;
  justify-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: var(--surface-2);
  color: var(--text-soft);
}

.scenario-handle:hover {
  background: var(--surface-3);
}

.scenario-handle > span:last-child {
  writing-mode: vertical-rl;
  letter-spacing: 2px;
}

.handle-arrow {
  color: #74a7ff;
  font-size: 20px;
}

.scenario-panel {
  display: none;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  background: var(--surface-1);
}

.scenario-console.is-open .scenario-panel,
.scenario-console:not(.is-collapsed) .scenario-panel,
.scenario-console[data-state="open"] .scenario-panel {
  display: flex;
}

.scenario-console.is-open .scenario-handle,
.scenario-console:not(.is-collapsed) .scenario-handle,
.scenario-console[data-state="open"] .scenario-handle {
  display: none;
}

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

.scenario-header > div,
.drawer-header > div {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.scenario-header strong,
.drawer-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
}

.scenario-header span,
.drawer-header p {
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scenario-scroll,
.drawer-scroll {
  min-height: 0;
  overflow-y: auto;
}

.scenario-scroll {
  flex: 1 1 auto;
  padding: 12px 12px 22px;
}

.scenario-summary {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid #2a3b50;
  border-radius: 6px;
  background: #141d28;
}

.scenario-summary > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

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

.scenario-summary strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-chip.is-success {
  background: var(--success-soft);
  color: var(--success);
}

.scenario-controls,
.scenario-catalog,
.scenario-events {
  margin-top: 18px;
}

.scenario-controls h2,
.scenario-catalog h2,
.scenario-events h2 {
  margin: 0 0 9px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
}

.scenario-controls > label:not(.switch-row) {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: center;
  min-height: 38px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: 12px;
}

.scenario-controls select,
.scenario-controls input[type="number"] {
  width: 100%;
  height: 30px;
  padding: 0 26px 0 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-soft);
}

.scenario-controls select {
  color-scheme: dark;
}

.scenario-controls input:disabled {
  color: var(--muted-2);
  opacity: 0.7;
}

.compact-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.compact-fields label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.switch-row {
  position: relative;
  display: flex;
  min-height: 50px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border-soft);
}

.switch-row > span {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.switch-row strong {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 500;
}

.switch-row small {
  overflow: hidden;
  color: var(--muted-2);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.switch-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch-row i {
  position: relative;
  flex: 0 0 auto;
  width: 32px;
  height: 18px;
  border-radius: 9px;
  background: #35404c;
  transition: background 140ms ease;
}

.switch-row i::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #a8b1bc;
  transition: transform 140ms ease, background 140ms ease;
  content: "";
}

.switch-row input:checked + i {
  background: var(--blue);
}

.switch-row input:checked + i::after {
  transform: translateX(14px);
  background: #fff;
}

.switch-row input:focus-visible + i {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.scenario-catalog details {
  border-bottom: 1px solid var(--border-soft);
}

.scenario-catalog summary {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  color: var(--text-soft);
  font-size: 12px;
  list-style: none;
}

.scenario-catalog summary::-webkit-details-marker {
  display: none;
}

.scenario-catalog summary::before {
  display: inline-block;
  width: 14px;
  color: var(--muted);
  content: "›";
  transform: rotate(0);
  transition: transform 120ms ease;
}

.scenario-catalog details[open] summary::before {
  transform: rotate(90deg);
}

.scenario-catalog summary span {
  margin-left: auto;
  color: var(--muted-2);
  font-size: 12px;
}

.scenario-list {
  display: grid;
  gap: 4px;
  padding: 0 0 8px 14px;
}

.scenario-list button {
  display: grid;
  gap: 3px;
  min-height: 45px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  text-align: left;
}

.scenario-list button:hover {
  border-color: var(--border);
  background: var(--hover);
}

.scenario-list button.is-active,
.scenario-list button[aria-current="true"] {
  border-color: rgba(51, 156, 255, 0.42);
  background: var(--blue-soft);
}

.scenario-list strong {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 550;
}

.scenario-list span {
  overflow: hidden;
  color: var(--muted-2);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.section-title-row > button,
.settings-section .section-title-row > button {
  padding: 0;
  border: 0;
  background: transparent;
  color: #72a4fb;
  font-size: 12px;
}

.scenario-events ol {
  margin: 0;
  padding: 8px 9px;
  border-radius: 5px;
  background: var(--bg);
  list-style: none;
}

.scenario-events li {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 7px;
  padding: 4px 0;
  color: var(--muted);
  font-size: 12px;
}

.scenario-events time {
  color: var(--muted-2);
}

.scenario-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}

.context-menu {
  position: fixed;
  z-index: 70;
  top: 58px;
  left: 222px;
  width: 232px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-3);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.34);
}

.context-menu > button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 50px;
  padding: 6px 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  text-align: left;
}

.context-menu > button:hover {
  background: var(--surface-4);
}

.menu-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 5px;
  background: var(--blue-soft);
  color: #75a8ff;
  font-size: 12px;
  font-weight: 650;
}

.context-menu > button > span:last-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.context-menu strong {
  font-size: 12px;
  font-weight: 550;
}

.context-menu small {
  color: var(--muted);
  font-size: 12px;
}

.drawer-backdrop {
  position: fixed;
  z-index: 79;
  inset: 0;
  background: rgba(0, 0, 0, 0.44);
}

.drawer {
  position: fixed;
  z-index: 80;
  top: 0;
  right: 0;
  display: grid;
  grid-template-rows: 70px minmax(0, 1fr);
  width: min(430px, calc(100vw - 60px));
  height: 100vh;
  border-left: 1px solid var(--border);
  background: var(--surface-1);
  box-shadow: -20px 0 50px rgba(0, 0, 0, 0.28);
  transform: translateX(100%);
  transition: transform 180ms ease;
}

.drawer:not([hidden]),
.drawer.is-open {
  transform: translateX(0);
}

.drawer-wide {
  grid-template-rows: 70px 58px minmax(0, 1fr) 58px;
  width: min(620px, calc(100vw - 80px));
}

.drawer-header {
  padding: 0 18px 0 22px;
}

.drawer-header h2 {
  font-size: 16px;
}

.drawer-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-soft);
}

.drawer-search {
  flex: 1 1 auto;
}

.file-list {
  min-height: 0;
  overflow-y: auto;
  padding: 8px 12px;
}

.file-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto 34px;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 10px;
  border-bottom: 1px solid var(--border-soft);
}

.file-row:hover {
  background: var(--hover);
}

.file-row > div {
  display: grid;
  min-width: 0;
  gap: 5px;
}

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

.file-row strong {
  font-size: 12px;
  font-weight: 550;
}

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

.file-row > button:not(.icon-button) {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-3);
  color: #72a4fb;
  font-size: 12px;
}

.file-type-video {
  background: #6854a1;
}

.file-type-folder {
  background: #91723c;
}

.drawer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 18px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

.drawer-scroll {
  padding: 0 20px 28px;
}

.settings-section {
  padding: 20px 0 6px;
  border-bottom: 1px solid var(--border);
}

.settings-section h3 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.settings-section .section-title-row {
  margin-bottom: 10px;
}

.settings-section .section-title-row h3 {
  margin: 0;
}

.member-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}

.member-grid > button {
  display: grid;
  min-width: 0;
  justify-items: center;
  gap: 4px;
  min-height: 78px;
  padding: 7px 3px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
}

.member-grid > button:hover {
  border-color: var(--border);
  background: var(--hover);
}

.member-grid .avatar {
  width: 34px;
  height: 34px;
}

.member-grid strong,
.member-grid small {
  width: 100%;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-grid strong {
  font-size: 12px;
  font-weight: 500;
}

.member-grid small {
  color: var(--muted-2);
  font-size: 12px;
}

.member-more > span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px dashed #45515f;
  border-radius: 50%;
  color: var(--muted);
  font-size: 12px;
}

.settings-link {
  display: flex;
  width: 100%;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--border-soft);
  background: transparent;
  text-align: left;
}

.settings-link:hover {
  background: var(--hover);
}

.settings-link > span:first-child {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.settings-link strong {
  font-size: 12px;
  font-weight: 500;
}

.settings-link small {
  overflow: hidden;
  color: var(--muted-2);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-link > span:last-child {
  color: var(--muted);
  font-size: 20px;
}

.danger-zone {
  display: grid;
  gap: 8px;
  border-bottom: 0;
}

.danger-zone button {
  min-height: 36px;
  border: 1px solid rgba(225, 101, 105, 0.26);
  border-radius: 5px;
  background: var(--danger-soft);
  color: #ed8588;
}

.danger-zone button:hover {
  border-color: rgba(225, 101, 105, 0.46);
  background: rgba(225, 101, 105, 0.18);
}

.danger-text {
  color: #ed8588 !important;
}

.announcement-form {
  display: grid;
  grid-template-rows: auto 190px auto minmax(0, 1fr) auto;
  min-height: 0;
  padding: 22px;
}

.announcement-form > label {
  margin-bottom: 8px;
  color: var(--text-soft);
  font-size: 12px;
}

.announcement-form textarea {
  width: 100%;
  min-height: 190px;
  padding: 12px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text);
  line-height: 1.6;
}

.field-meta {
  display: flex;
  min-height: 28px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.field-meta p {
  margin: 0;
}

.announcement-preview {
  align-self: start;
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
}

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

.announcement-preview p {
  margin: 9px 0 0;
  color: var(--text-soft);
  line-height: 1.6;
}

.announcement-form footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.app-dialog {
  width: min(480px, calc(100vw - 48px));
  max-height: min(760px, calc(100vh - 48px));
  padding: 0;
  overflow: hidden;
  border: 1px solid #303a46;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
}

.app-dialog::backdrop {
  background: rgba(4, 7, 10, 0.7);
}

.app-dialog > form {
  display: grid;
  min-height: 0;
}

.app-dialog > form > header {
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px 0 22px;
  border-bottom: 1px solid var(--border);
}

.app-dialog > form > header > div {
  min-width: 0;
}

.app-dialog h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}

.app-dialog header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.dialog-body {
  min-height: 0;
  padding: 20px 22px;
  overflow-y: auto;
}

.app-dialog > form > footer {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 22px;
  border-top: 1px solid var(--border);
}

.field-label {
  display: grid;
  gap: 8px;
  color: var(--text-soft);
  font-size: 12px;
}

.field-label input {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-1);
  color: var(--text);
}

.field-error,
.dialog-error {
  color: #ed8588;
}

.invite-dialog {
  width: min(520px, calc(100vw - 32px));
}

.invite-dialog.is-share-mode {
  width: min(420px, calc(100vw - 48px));
}

.invite-dialog > form {
  grid-template-rows: 64px minmax(0, 1fr) auto 60px;
  height: min(400px, calc(100vh - 32px));
}

.invite-dialog.is-share-mode > form {
  grid-template-rows: 70px minmax(0, 1fr);
  height: min(360px, calc(100vh - 48px));
}

.invite-dialog.is-share-mode > form > footer {
  display: none;
}

.invite-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(210px, 0.8fr);
  gap: 20px;
}

.invite-layout > section {
  min-width: 0;
}

.invite-layout h3,
.selected-members h3 {
  margin: 16px 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.invite-eligibility-note {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
}

.invite-empty-alternatives {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.invite-empty-alternatives[hidden] {
  display: none;
}

.invite-empty-alternatives p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
}

.invite-empty-alternatives > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.invite-empty-alternatives .secondary-button {
  min-height: 30px;
  padding: 0 10px;
}

.select-member-list {
  display: grid;
}

.member-option {
  display: grid;
  grid-template-columns: 20px 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 5px 7px;
  border-radius: 5px;
}

.member-option:hover {
  background: var(--hover);
}

.member-option > input {
  width: 15px;
  height: 15px;
  accent-color: var(--blue);
}

.member-option .avatar {
  width: 36px;
  height: 36px;
}

.member-option > span:last-child {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.member-option strong {
  font-size: 12px;
  font-weight: 500;
}

.member-option small {
  color: var(--muted);
  font-size: 12px;
}

.member-option.is-disabled {
  opacity: 0.5;
}

.selected-members {
  min-width: 0;
  padding: 0 0 0 18px;
  border-left: 1px solid var(--border);
}

.selected-members h3 {
  margin-top: 2px;
}

.selected-empty {
  display: grid;
  min-height: 120px;
  place-items: center;
  color: var(--muted-2);
  font-size: 12px;
}

.dialog-error {
  margin: 0 22px;
  padding: 8px 10px;
  border-radius: 5px;
  background: var(--danger-soft);
  font-size: 12px;
}

.find-dialog {
  width: min(560px, calc(100vw - 48px));
}

.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  width: 180px;
  padding: 3px;
  border-radius: 5px;
  background: var(--surface-1);
}

.segmented-control button {
  min-height: 30px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.segmented-control button.is-active,
.segmented-control button[aria-selected="true"] {
  background: var(--surface-4);
  color: var(--text);
}

.dialog-search.large {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 16px;
}

.dialog-search.large .search-icon {
  top: 12px;
}

.find-results {
  display: grid;
  min-height: 132px;
  place-items: center;
  margin-top: 14px;
  border: 1px dashed var(--border);
  border-radius: 5px;
  color: var(--muted);
  font-size: 12px;
}

.compact-dialog {
  width: min(420px, calc(100vw - 48px));
}

.member-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 22px;
}

.member-profile .avatar {
  width: 46px;
  height: 46px;
}

.member-profile > div {
  display: grid;
  gap: 5px;
}

.member-profile strong {
  font-size: 14px;
}

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

.member-actions {
  display: grid;
  gap: 8px;
  padding: 0 22px 22px;
}

.member-actions button {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-3);
}

.member-actions button:hover {
  background: var(--surface-4);
}

.toast {
  position: fixed;
  z-index: 100;
  top: 24px;
  right: auto;
  bottom: auto;
  left: 50%;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 8px;
  width: min(360px, calc(100vw - 48px));
  min-height: 52px;
  padding: 8px 9px 8px 13px;
  border: 1px solid #35414e;
  border-radius: 7px;
  background: #222a34;
  color: var(--text);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
  transform: translateX(-50%);
}

.app-dialog:has(> .toast.is-in-dialog-layer) {
  overflow: visible;
}

.app-dialog > .toast.is-in-dialog-layer {
  z-index: 1000;
}

.toast-icon {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
  font-size: 12px;
}

.toast.is-error .toast-icon {
  background: var(--danger-soft);
  color: var(--danger);
}

/* Contracts used by the JavaScript render layer. */
.scenario-stage {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
}

.search-page {
  width: min(780px, calc(100% - 48px));
  margin: 0 auto;
  padding-top: 74px;
}

.search-page > header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.search-page h2,
.state-page h2 {
  margin: 4px 0 0;
  font-size: 20px;
  font-weight: 650;
}

.state-kicker {
  margin: 0;
  color: #75a8ff;
  font-size: 12px;
}

.search-page > header label {
  width: min(320px, 48%);
}

.search-page > header input {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text);
}

.group-avatar--large {
  width: 52px;
  height: 52px;
  border-radius: 50%;
}

.state-page {
  display: grid;
  justify-items: center;
  width: min(480px, calc(100% - 48px));
  margin: 20vh auto 0;
  text-align: center;
}

.state-page > p:not(.state-kicker) {
  margin: 10px 0 20px;
  color: var(--muted);
  line-height: 1.65;
}

.state-page > button {
  min-height: 36px;
  padding: 0 15px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--text-soft);
}

.scenario-panel > .scenario-summary {
  flex: 0 0 auto;
  margin: 12px 12px 0;
}

.scenario-panel > .scenario-summary > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.scenario-panel > .scenario-summary > div + div {
  padding-left: 10px;
  border-left: 1px solid var(--border);
}

.scenario-role {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: 84px minmax(0, 1fr);
  align-items: center;
  min-height: 46px;
  margin: 8px 12px 0;
  color: var(--muted);
  font-size: 12px;
}

.scenario-role select {
  width: 100%;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-soft);
}

.workflow-progress,
.scenario-groups,
.scenario-log {
  flex: 0 0 auto;
  margin: 12px 12px 0;
}

.workflow-progress > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.workflow-progress h3,
.scenario-groups h3,
.scenario-log h3 {
  margin: 0 0 8px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
}

.workflow-progress > header span {
  color: var(--muted);
  font-size: 12px;
}

.workflow-progress ol {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.workflow-progress li {
  min-width: 0;
  min-height: 32px;
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
}

.workflow-progress li > button {
  display: flex;
  width: 100%;
  min-height: 30px;
  align-items: center;
  gap: 5px;
  padding: 4px 5px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.workflow-progress li > button:hover {
  background: var(--surface-3);
  color: var(--text-soft);
}

.workflow-progress li > button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.workflow-progress li > button > span {
  display: grid;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-4);
  color: var(--muted);
  font-size: 12px;
}

.workflow-progress li.is-done {
  border-color: rgba(69, 201, 140, 0.28);
  background: var(--success-soft);
  color: #8adbb5;
}

.workflow-progress li.is-done > button > span {
  background: var(--success);
  color: #092218;
}

.workflow-progress > button {
  width: 100%;
  min-height: 30px;
  margin-top: 7px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 12px;
}

.scenario-groups {
  display: grid;
  gap: 10px;
}

.scenario-groups > section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.scenario-groups h3 {
  grid-column: 1 / -1;
  margin-bottom: 2px;
  color: var(--muted);
}

.scenario-groups button {
  min-height: 34px;
  padding: 5px 7px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  background: transparent;
  color: var(--text-soft);
  font-size: 12px;
  text-align: left;
  text-overflow: ellipsis;
}

.scenario-groups button:hover {
  border-color: #3a4654;
  background: var(--hover);
}

.scenario-groups button.is-active {
  border-color: rgba(51, 156, 255, 0.5);
  background: var(--blue-soft);
  color: #8cb8ff;
}

.scenario-run {
  flex: 0 0 auto;
  margin: 10px 12px 0;
}

.scenario-log ol {
  max-height: 122px;
  margin: 0;
  padding: 8px 9px;
  overflow-y: auto;
  border-radius: 5px;
  background: var(--bg);
  list-style: none;
}

.scenario-log li {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 7px;
  padding: 3px 0;
  color: var(--muted);
  font-size: 12px;
}

.scenario-log time {
  color: var(--muted-2);
}

.scenario-log > p {
  margin: 0;
  padding: 13px;
  border-radius: 5px;
  background: var(--bg);
  color: var(--muted-2);
  font-size: 12px;
  text-align: center;
}

.scenario-panel > footer {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  min-height: 58px;
  margin-top: 12px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface-1);
}

.scenario-panel > footer button {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--text-soft);
  font-size: 12px;
}

.scenario-panel > footer button:last-child {
  border-color: transparent;
  background: var(--blue);
  color: #fff;
}

.member-choice {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  text-align: left;
}

.member-choice:hover:not(:disabled) {
  border-color: var(--border);
  background: var(--hover);
}

.member-choice.is-selected {
  border-color: rgba(51, 156, 255, 0.42);
  background: var(--blue-soft);
}

.member-choice:disabled {
  opacity: 0.5;
}

.member-choice > span:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.member-choice strong {
  font-size: 12px;
  font-weight: 500;
}

.member-choice small,
.choice-state {
  color: var(--muted);
  font-size: 12px;
}

.member-choice.is-selected .choice-state {
  color: #79aaff;
}

.member-row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-soft);
}

.member-row > div:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.member-row strong {
  font-size: 12px;
  font-weight: 500;
}

.member-row small {
  color: var(--muted);
  font-size: 12px;
}

.member-row .member-actions {
  display: flex;
  gap: 4px;
  padding: 0;
}

.member-row .member-actions button {
  min-height: 28px;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--text-soft);
  font-size: 12px;
}

.member-management-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 116px auto;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
}

.member-management-search {
  position: relative;
  min-width: 0;
}

.member-management-search .search-icon {
  position: absolute;
  top: 50%;
  left: 10px;
  translate: 0 -50%;
}

.member-management-search input,
.member-management-toolbar select {
  width: 100%;
  min-height: 32px;
}

.member-management-search input {
  padding-left: 30px;
}

.member-bulk-bar {
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
}

.member-list-results {
  display: grid;
}

.member-row__actions {
  display: grid;
  width: 32px;
  min-width: 32px;
  place-items: center;
}

.member-row__actions > .icon-button,
.member-select-control {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
}

.member-select-control input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.member-empty {
  display: grid;
  min-height: 112px;
  place-items: center;
  align-content: center;
  gap: 4px;
  color: var(--muted);
  text-align: center;
}

.member-empty span {
  font-size: 12px;
}

.member-action-menu {
  position: fixed;
  z-index: 145;
  display: grid;
  width: 144px;
  margin: 0;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.3);
}

.member-action-menu[hidden],
.member-action-menu button[hidden] {
  display: none;
}

.member-action-menu button {
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-soft);
  text-align: left;
}

.member-action-menu button:hover,
.member-action-menu button:focus-visible {
  background: var(--surface-4);
  color: var(--text);
  outline: 0;
}

.file-row > nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.file-row > nav button {
  min-height: 28px;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-3);
  color: #72a4fb;
  font-size: 12px;
}

.file-row > nav button[aria-disabled="true"] {
  color: var(--muted-2);
  opacity: 0.62;
}

.confirm-dialog {
  width: min(420px, calc(100vw - 48px));
  padding: 0;
  overflow: hidden;
  border: 1px solid #303a46;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
}

.confirm-dialog::backdrop {
  background: rgba(4, 7, 10, 0.7);
}

.confirm-dialog form {
  padding: 22px;
}

.confirm-dialog h2 {
  margin: 0;
  font-size: 16px;
}

.confirm-dialog p {
  margin: 10px 0 22px;
  color: var(--muted);
  line-height: 1.6;
}

.confirm-dialog footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.confirm-dialog footer button {
  min-height: 36px;
  padding: 0 15px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--text-soft);
}

@media (max-width: 1439px) {
  :root {
    --conversation-width: 304px;
    --scenario-open-width: 320px;
  }

  .entry-tabs {
    gap: 18px;
    padding-inline: 18px;
  }

  .conversation-row {
    grid-template-columns: 44px minmax(0, 1fr) 38px;
    gap: 9px;
    padding-inline: 7px;
  }

  .group-avatar {
    width: 42px;
    height: 42px;
  }

  .chat-header {
    padding-inline: 22px 18px;
  }

  .message-list {
    padding-inline: 24px;
  }

  .composer,
  .muted-composer {
    margin-inline: 22px;
  }

  .header-action {
    padding-inline: 8px;
  }

  .scenario-scroll {
    padding-inline: 10px;
  }
}

@media (min-width: 1800px) {
  :root {
    --conversation-width: 360px;
    --scenario-open-width: 348px;
  }

  .entry-tabs {
    gap: 30px;
    padding-inline: 26px;
  }

  .chat-header {
    padding-inline: 34px 28px;
  }

  .message-list {
    padding-inline: 34px;
  }

  .composer,
  .muted-composer {
    margin-inline: 30px;
  }
}

@media (max-height: 759px) {
  .conversation-pane {
    grid-template-rows: 60px minmax(0, 1fr);
  }

  .entry-tabs {
    padding-bottom: 14px;
  }

  .entry-tab.is-active::after,
  .entry-tab[aria-selected="true"]::after {
    bottom: -15px;
  }

  .sidebar-section {
    grid-template-rows: minmax(0, 1fr) 50px;
  }

  .conversation-row {
    min-height: 61px;
  }

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

  .chat-header {
    min-height: 76px;
  }

  .announcement-strip {
    min-height: 42px;
    margin-top: 8px;
  }

  .message-list {
    padding-top: 16px;
    padding-bottom: 18px;
  }

  .message {
    margin-bottom: 15px;
  }

  .composer {
    grid-template-rows: auto 30px minmax(44px, auto) 38px;
    min-height: 122px;
    margin-bottom: 12px;
  }

  .composer textarea {
    min-height: 44px;
  }

  .scenario-panel {
    grid-template-rows: 58px minmax(0, 1fr) 58px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Full PRD restoration: contacts, direct messages, finder and group details. */
.contact-category-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--border-soft);
}

.contact-category-tabs button,
.finder-mode button,
.invite-method-tabs button {
  min-width: 0;
  min-height: 30px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.contact-category-tabs button:hover,
.contact-category-tabs button.is-active,
.finder-mode button:hover,
.finder-mode button.is-active,
.invite-method-tabs button:hover,
.invite-method-tabs button.is-active {
  background: var(--surface-3);
  color: var(--text);
}

.contact-category-tabs button {
  position: relative;
}

.contact-category-tabs b {
  display: inline-grid;
  min-width: 15px;
  height: 15px;
  margin-left: 3px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-size: 12px;
}

.contact-list {
  min-height: 0;
  overflow-y: auto;
}

.contact-row {
  width: 100%;
  min-height: 58px;
  padding: 8px 12px;
  border: 0;
  border-left: 2px solid transparent;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.contact-row:hover,
.contact-row.is-active {
  border-left-color: var(--accent);
  background: var(--surface-3);
}

.contact-row > span:not(.avatar) {
  display: grid;
  min-width: 0;
  gap: 4px;
}

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

.contact-row em,
.contact-detail-hero em {
  margin-left: 6px;
  color: #ffbe61;
  font-size: 12px;
  font-style: normal;
}

.contact-empty,
.file-empty {
  display: grid;
  min-height: 240px;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.contact-empty button {
  min-height: 32px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--text);
}

.avatar--conversation {
  width: 42px;
  height: 42px;
}

.avatar--profile {
  width: 68px;
  height: 68px;
}

.avatar--tiny {
  width: 22px;
  height: 22px;
}

.special-preview {
  color: #f1b965;
}

.conversation-muted {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.contact-detail-page,
.group-detail-page {
  display: grid;
  width: min(620px, calc(100% - 64px));
  margin: 0 auto;
  padding: clamp(58px, 10vh, 110px) 0 40px;
}

.contact-detail-hero {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--border-soft);
}

.contact-detail-hero h2,
.group-detail-page h2 {
  margin: 0;
  color: var(--text);
  font-size: 20px;
  letter-spacing: 0;
}

.contact-detail-hero p,
.group-detail-page > p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.relation-chip {
  padding: 4px 8px;
  border: 1px solid #3a4d68;
  border-radius: 4px;
  color: #8bb7ff;
  font-size: 12px;
}

.contact-facts,
.group-detail-facts {
  display: grid;
  margin: 24px 0;
}

.contact-facts > div,
.group-detail-facts > div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  min-height: 42px;
  align-items: center;
  border-bottom: 1px solid var(--border-soft);
}

.contact-facts dt,
.group-detail-facts dt {
  color: var(--muted);
  font-size: 12px;
}

.contact-facts dd,
.group-detail-facts dd {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
}

.contact-facts dd button,
.group-detail-facts dd button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-bright);
}

.contact-primary-actions,
.contact-secondary-actions,
.group-detail-actions {
  display: flex;
  gap: 10px;
}

.contact-primary-actions button,
.contact-secondary-actions button,
.group-detail-actions button {
  min-height: 36px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--text);
}

.contact-primary-actions .primary-button,
.group-detail-actions .primary-button {
  border-color: var(--accent);
  background: var(--accent);
}

.contact-secondary-actions {
  margin-top: 12px;
}

.contact-secondary-actions button {
  background: transparent;
  color: var(--muted);
}

.group-detail-page {
  justify-items: center;
  text-align: center;
}

.group-avatar--detail {
  width: 86px;
  height: 86px;
  margin-bottom: 18px;
}

.group-detail-facts {
  width: min(440px, 100%);
  text-align: left;
}

.group-resource-summary {
  display: grid;
  width: min(440px, 100%);
  gap: 8px;
  margin: 0 0 24px;
  padding: 14px 0;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
}

.group-resource-summary header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.group-resource-summary header > div {
  display: grid;
  gap: 3px;
}

.group-resource-summary span,
.group-resource-summary p {
  color: var(--muted);
  font-size: 12px;
}

.group-resource-summary strong {
  color: var(--text);
  font-size: 14px;
}

.group-resource-summary p {
  margin: 0;
  line-height: 18px;
}

.group-resource-summary button {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: var(--selected);
  color: var(--accent-bright);
}

.compact-action-dialog {
  width: min(420px, calc(100vw - 40px));
}

.compact-action-list {
  display: grid;
  gap: 8px;
  padding: 12px 18px 18px;
}

.compact-action-list > button {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 2px 12px;
  min-height: 64px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text);
  text-align: left;
}

.compact-action-list > button:hover {
  border-color: #465a75;
  background: var(--surface-3);
}

.compact-action-list > button > span {
  grid-row: 1 / 3;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent-bright);
  font-size: 18px;
}

.compact-action-list small {
  color: var(--muted);
}

.finder-dialog {
  width: min(620px, calc(100vw - 48px));
}

.finder-mode,
.invite-method-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 18px 0;
}

.finder-mode button,
.invite-method-tabs button {
  min-width: 72px;
  padding: 0 12px;
}

.finder-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 12px 18px;
}

.finder-form input {
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-1);
  color: var(--text);
}

.finder-form input:focus {
  border-color: var(--accent);
  outline: none;
}

.finder-result {
  min-height: 178px;
  padding: 0 18px 18px;
}

.finder-placeholder,
.finder-empty {
  display: grid;
  min-height: 160px;
  place-content: center;
  justify-items: center;
  gap: 7px;
  margin: 0;
  color: var(--muted);
  text-align: center;
}

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

.finder-empty.is-error strong {
  color: var(--danger);
}

.finder-result-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  min-height: 86px;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
}

.finder-result-card > div {
  display: grid;
  gap: 5px;
}

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

.finder-card-actions {
  display: flex !important;
  gap: 6px;
}

.finder-card-actions button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--text-soft);
}

.invite-follow-dialog {
  width: min(500px, calc(100vw - 48px));
}

.invite-follow-dialog form {
  padding: 16px 18px 18px;
}

.invite-follow-dialog label {
  color: var(--text-soft);
  font-size: 12px;
}

.invite-follow-dialog textarea {
  width: 100%;
  min-height: 104px;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-1);
  color: var(--text);
  resize: none;
}

.invite-follow-dialog footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.invite-method-tabs {
  grid-column: 1 / -1;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--border-soft);
}

.invite-share-method {
  grid-column: 1 / -1;
  min-height: 310px;
}

.invite-share-card {
  display: grid;
  min-height: 300px;
  place-content: center;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.invite-dialog.is-share-mode .invite-layout {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  overflow-y: auto;
}

.invite-dialog.is-share-mode .invite-share-method {
  min-height: 0;
}

.invite-dialog.is-share-mode .invite-share-card {
  min-height: 0;
  padding: 20px 24px 24px;
}

.invite-dialog.is-share-mode .invite-qr-image {
  width: 112px;
  height: 112px;
}

.invite-dialog.is-share-mode .invite-share-card p {
  max-width: 340px;
  overflow-wrap: anywhere;
}

.invite-share-card h3,
.invite-share-card p {
  margin: 0;
}

.invite-share-card p {
  color: var(--muted);
  font-size: 12px;
}

.share-method-icon {
  display: grid;
  width: 66px;
  height: 66px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-bright);
  font-size: 28px;
}

.group-identity-settings {
  display: grid;
  gap: 12px;
}

.group-identity-settings label {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.group-identity-settings input {
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text);
}

.group-id-row {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) auto;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.group-id-row strong {
  color: var(--text-soft);
}

.group-id-row button {
  border: 0;
  background: transparent;
  color: var(--accent-bright);
}

.private-chat-page {
  display: grid;
  min-height: 100%;
  grid-template-rows: 70px auto minmax(0, 1fr) auto;
  grid-template-areas:
    "header"
    "relationship"
    "messages"
    "composer";
  overflow: hidden;
}

.private-chat-page > header {
  grid-area: header;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-soft);
}

.private-chat-page > header > div,
.private-chat-page > header nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.private-chat-page h2 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
}

.private-chat-page header small {
  color: var(--muted);
}

.private-chat-page header button {
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--text-soft);
}

.relationship-strip {
  grid-area: relationship;
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 7px 20px;
  border-bottom: 1px solid #2c3a4e;
  background: #172131;
  color: var(--blue-hover);
  font-size: 12px;
}

.relationship-strip.is-warning {
  border-color: #4a3730;
  background: #2a201c;
}

.relationship-strip button {
  border: 0;
  background: transparent;
  color: var(--accent-bright);
}

.private-message-list {
  grid-area: messages;
  min-height: 0;
  margin: 0;
  padding: 24px 28px;
  overflow-y: auto;
  list-style: none;
}

.private-message {
  display: flex;
  margin-bottom: 16px;
}

.private-message.is-self {
  justify-content: flex-end;
}

.private-message > article {
  max-width: min(520px, 72%);
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  background: var(--surface-3);
}

.private-message.is-self > article {
  border-color: #3c72d5;
  background: #326bd2;
}

.private-message p {
  margin: 0;
  line-height: 1.6;
}

.private-message time {
  display: block;
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
}

.follow-invite-card {
  display: grid;
  min-width: 280px;
  gap: 10px;
  background: var(--surface-2) !important;
}

.follow-invite-card button,
.private-file-bubble button {
  min-height: 30px;
  border: 0;
  border-radius: 4px;
  background: var(--accent);
  color: var(--figma-button-text, #181818);
}

.follow-invite-status {
  display: flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-1);
  color: var(--muted);
  font-size: 12px;
}

.follow-invite-status.is-success {
  border-color: rgba(57, 189, 138, 0.38);
  background: rgba(57, 189, 138, 0.1);
  color: #79d9b4;
}

.private-file-bubble {
  display: grid;
  min-width: 250px;
  gap: 6px;
}

.private-file-bubble span {
  color: var(--muted);
  font-size: 12px;
}

.private-empty {
  display: grid;
  min-height: 100%;
  place-items: center;
  color: var(--muted);
}

.private-composer {
  grid-area: composer;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 122px;
  align-items: end;
  gap: 10px;
  margin: 0 24px 18px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-1);
}

.private-composer > div {
  display: flex;
  align-self: start;
}

.private-composer button {
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--text-soft);
}

.private-composer textarea {
  min-width: 0;
  height: 94px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  resize: none;
}

.private-composer > .primary-button {
  min-width: 74px;
  background: var(--accent);
  color: white;
}

.private-profile-row {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 20px;
  border-bottom: 1px solid var(--border-soft);
}

.private-profile-row > div {
  display: grid;
  gap: 5px;
}

.private-profile-row span {
  color: var(--muted);
  font-size: 12px;
}

.message-body {
  position: relative;
}

.message-context-menu {
  position: fixed;
  z-index: 140;
  display: grid;
  width: 112px;
  margin: 0;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--figma-surface-elevated);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.3);
}

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

.message-context-menu button {
  min-height: 32px;
  padding: 0 9px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--text-soft);
  text-align: left;
}

.message-context-menu button:hover,
.message-context-menu button:focus-visible {
  background: var(--surface-4);
  color: var(--text);
  outline: 0;
}

.message-body blockquote {
  margin: 0 0 7px;
  padding: 5px 8px;
  border-left: 2px solid var(--accent);
  background: rgba(0, 0, 0, 0.18);
  color: var(--muted);
  font-size: 12px;
}

.mention-member-menu {
  position: absolute;
  z-index: 5;
  bottom: calc(100% - 38px);
  left: 12px;
  display: grid;
  width: 220px;
  max-height: 260px;
  padding: 6px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.38);
}

.mention-member-menu button {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  padding: 4px 7px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.mention-member-menu button:hover {
  background: var(--surface-4);
}

.file-row {
  grid-template-columns: 24px 38px minmax(0, 1fr) auto;
}

.file-select {
  display: grid;
  place-items: center;
}

.file-select input {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}

.file-message.is-cancelled {
  opacity: 0.48;
}

.file-message.is-cancelled span {
  color: var(--danger);
}

.conversation-context-menu {
  position: fixed;
  z-index: 130;
  display: grid;
  width: 176px;
  margin: 0;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--figma-surface-elevated);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.42);
}

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

.conversation-context-menu button {
  min-height: 32px;
  padding: 0 9px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--text-soft);
  text-align: left;
}

.conversation-context-menu button:hover {
  background: var(--surface-4);
  color: var(--text);
}

.scenario-browser {
  display: grid;
  gap: 8px;
  padding: 10px 12px 0;
}

.scenario-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 3px;
  border-radius: 5px;
  background: var(--surface-3);
}

.scenario-mode button {
  min-height: 30px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
}

.scenario-mode button.is-active {
  background: var(--surface-1);
  color: var(--text);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.28);
}

.scenario-search input {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  outline: 0;
  background: var(--surface-2);
  color: var(--text);
}

.scenario-search input:focus {
  border-color: var(--accent);
}

.scenario-category {
  border-bottom: 1px solid var(--border-soft);
}

.scenario-category-toggle {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto 18px;
  width: 100%;
  min-height: 39px !important;
  align-items: center;
  gap: 7px;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--text-soft);
  text-align: left;
}

.scenario-category-toggle b,
.scenario-category-toggle i {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 500;
}

.scenario-category-items {
  display: grid;
  gap: 4px;
  padding-bottom: 8px;
}

.scenario-category-items[hidden] {
  display: none;
}

.scenario-category-items > button {
  display: grid;
  min-height: 48px;
  gap: 4px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--text-soft);
  text-align: left;
}

.scenario-category-items > button:hover {
  border-color: var(--border);
  background: var(--hover);
}

.scenario-category-items > button.is-active {
  border-color: rgba(51, 156, 255, 0.45);
  background: var(--blue-soft);
}

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

.scenario-category-items strong {
  font-size: 12px;
  font-weight: 600;
}

.scenario-category-items span {
  color: var(--muted);
  font-size: 12px;
}

.scenario-empty {
  margin: 20px 0;
  color: var(--muted);
  text-align: center;
}

.selected-invite-person {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 28px;
  min-height: 48px;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid var(--border-soft);
}

.selected-invite-person > span {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.selected-invite-person small {
  color: var(--muted);
}

.invite-qr-image {
  width: 152px;
  height: 152px;
  padding: 6px;
  border-radius: 4px;
  background: white;
  object-fit: contain;
}

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

.invite-share-actions button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--text-soft);
}

.file-search-history {
  position: absolute;
  z-index: 8;
  top: 58px;
  right: 18px;
  left: 18px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
}

.file-search-history header,
.file-search-history > div {
  display: flex;
  min-height: 32px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.file-search-history button {
  border: 0;
  background: transparent;
  color: var(--text-soft);
  text-align: left;
}

.desktop-notification {
  position: fixed;
  z-index: 220;
  right: 22px;
  bottom: 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  width: min(370px, calc(100vw - 44px));
  min-height: 82px;
  padding: 10px;
  border: 1px solid #354860;
  border-radius: 6px;
  background: #17212d;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}

.desktop-notification[hidden],
.tray-recent-messages[hidden] {
  display: none;
}

.desktop-notification > button:first-child,
.tray-recent-messages #tray-message-list > button {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.desktop-notification span,
.tray-recent-messages #tray-message-list span {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.desktop-notification small,
.tray-recent-messages small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.desktop-notification time {
  color: var(--muted);
  font-size: 12px;
}

.tray-simulator {
  position: fixed;
  z-index: 180;
  right: 18px;
  bottom: 18px;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid #476188;
  border-radius: 6px;
  background: #1c2a3b;
  color: #8bb6ff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.38);
}

.desktop-notification:not([hidden]) + .tray-recent-messages + .tray-simulator {
  display: none;
}

.tray-simulator b {
  position: absolute;
  top: -6px;
  right: -6px;
  display: none;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  place-items: center;
  border-radius: 9px;
  background: var(--danger);
  color: white;
  font-size: 12px;
}

.tray-simulator.has-unread b {
  display: grid;
}

.tray-recent-messages {
  position: fixed;
  z-index: 210;
  right: 18px;
  bottom: 68px;
  display: grid;
  width: min(380px, calc(100vw - 36px));
  max-height: min(520px, calc(100vh - 96px));
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 1px solid #354860;
  border-radius: 6px;
  overflow: hidden;
  background: #151f2a;
  box-shadow: 0 20px 52px rgba(0, 0, 0, 0.55);
}

.tray-recent-messages > header,
.tray-recent-messages > footer {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
}

.tray-recent-messages > header > div {
  display: grid;
  gap: 3px;
}

.tray-recent-messages > header span {
  color: var(--muted);
  font-size: 12px;
}

.tray-recent-messages #tray-message-list {
  overflow-y: auto;
}

.tray-recent-messages #tray-message-list > button {
  width: 100%;
  min-height: 62px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-soft);
}

.tray-recent-messages #tray-message-list > button:hover {
  background: var(--hover);
}

.tray-recent-messages #tray-message-list b {
  min-width: 20px;
  color: #78aaff;
  font-size: 12px;
  text-align: center;
}

.tray-recent-messages > footer {
  border-top: 1px solid var(--border);
  border-bottom: 0;
}

.tray-recent-messages > footer button {
  width: 100%;
  border: 0;
  background: transparent;
  color: #80adff;
}

.tray-empty {
  padding: 28px 14px;
  color: var(--muted);
  text-align: center;
}

.cloud-path-list,
.cloud-picker-list {
  display: grid;
  gap: 6px;
  padding: 14px 18px 18px;
  overflow-y: auto;
}

.cloud-path-list button,
.cloud-picker-list button {
  display: grid;
  min-height: 48px;
  align-content: center;
  gap: 4px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-soft);
  text-align: left;
}

.cloud-path-list button:hover,
.cloud-picker-list button:hover {
  border-color: #44658e;
  background: var(--surface-3);
}

.cloud-picker-list span {
  color: var(--muted);
  font-size: 12px;
}

.relationship-strip nav {
  display: flex;
  align-items: center;
  gap: 7px;
}

.private-message > article {
  position: relative;
}

.private-message.is-failed > article {
  border-color: rgba(225, 101, 105, 0.68);
}

.private-message blockquote {
  margin: 0 0 7px;
  padding: 5px 8px;
  border-left: 2px solid #8bb6ff;
  background: rgba(0, 0, 0, 0.16);
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.private-reply-preview {
  grid-column: 1 / -1;
  display: flex !important;
  min-height: 32px;
  align-items: center;
  justify-content: space-between;
  align-self: auto !important;
  padding: 0 8px;
  border-left: 2px solid var(--accent);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}

.private-composer:has(.private-reply-preview) {
  grid-template-rows: auto 1fr;
}

.private-composer button:disabled {
  cursor: default;
  opacity: 0.42;
}

@media (max-width: 1100px) {
  .contact-detail-page,
  .group-detail-page {
    width: min(560px, calc(100% - 40px));
  }

  .private-chat-page > header {
    padding-inline: 18px;
  }

  .private-message-list {
    padding-inline: 20px;
  }

  .private-composer {
    margin-inline: 18px;
  }
}
