:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-soft: #f9fafb;
  --stroke: #e5e7eb;
  --stroke-strong: #d1d5db;
  --text: #111827;
  --muted: #6b7280;
  --muted-strong: #4b5563;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --success: #16a34a;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-width: 320px;
  color: var(--text);
  background: var(--bg);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.hidden {
  display: none !important;
}

.page-shell {
  width: min(1360px, calc(100% - 24px));
  height: calc(100vh - 24px);
  margin: 12px auto;
}

.login-screen,
.sidebar,
.main-panel {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: var(--panel);
}

.login-screen {
  min-height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
}

.login-copy,
.login-form,
.brand-card,
.friend-card,
.chat-card,
.topbar,
.composer {
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: var(--panel);
  padding: 16px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 0;
  font-size: 32px;
  line-height: 1.12;
  letter-spacing: 0;
  text-align: center;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.login-copy p:last-child,
.composer-hint,
.inline-status {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.login-form,
.stack-form,
.add-friend-form,
.create-group-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-form label,
.stack-form label,
.ttl-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-form span,
.stack-form span,
.ttl-field span {
  color: var(--muted);
  font-size: 12px;
}

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  outline: none;
  background: #ffffff;
  color: var(--text);
  padding: 10px 12px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

input::placeholder,
textarea::placeholder {
  color: #9ca3af;
}

button {
  border: 0;
  cursor: pointer;
}

.primary-button,
.ghost-button,
.danger-button {
  min-height: 32px;
  border-radius: 8px;
  padding: 7px 12px;
  font-weight: 700;
  font-size: 13px;
}

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

.send-button {
  min-height: 40px;
  padding: 9px 16px;
  font-size: 14px;
}

.primary-button.compact,
.ghost-button.compact,
.danger-button.compact {
  min-height: 28px;
  padding: 5px 8px;
  font-size: 12px;
}

.primary-button {
  background: var(--accent);
  color: #ffffff;
}

.ghost-button {
  border: 1px solid var(--stroke);
  background: var(--panel);
  color: var(--text);
}

.danger-button {
  border: 1px solid #fecaca;
  background: var(--danger-soft);
  color: var(--danger);
}

.primary-button:hover,
.send-button:hover {
  background: #1d4ed8;
}

.ghost-button:hover {
  border-color: var(--stroke-strong);
  background: var(--panel-soft);
}

.danger-button:hover {
  border-color: #fca5a5;
  background: #fee2e2;
}

.login-status {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.login-actions,
.brand-actions,
.form-row,
.pending-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.login-actions > *,
.form-row > * {
  flex: 1;
}

.login-copy {
  width: min(420px, 100%);
  padding: 0;
  border: 0;
  background: transparent;
  text-align: center;
}

.app-shell {
  height: 100%;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 12px;
}

.mobile-tabbar {
  display: none;
}

.settings-panel-host,
.admin-users-panel-host {
  display: none;
}

.settings-panel,
.admin-users-panel {
  display: grid;
  gap: 10px;
}

.settings-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sidebar {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  padding: 12px;
}

.brand-card,
.topbar,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-card {
  padding: 14px 16px;
}

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

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

.brand-meta strong {
  font-size: 14px;
}

.brand-meta span {
  color: var(--muted);
  font-size: 13px;
}

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

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

.friend-list,
.chat-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.friend-list.collapsed {
  display: none;
}

.chat-item {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  text-align: left;
  transition: background 140ms ease, border-color 140ms ease;
}

.friend-item {
  width: 100%;
  border-radius: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 3px;
}

.friend-main {
  min-width: 0;
  border-radius: 8px;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 7px;
  text-align: left;
}

.friend-item:hover,
.chat-item:hover {
  background: var(--panel-soft);
}

.chat-item.active {
  border-color: #bfdbfe;
  background: var(--accent-soft);
}

.avatar,
.message-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #eef2ff;
  color: #3730a3;
  font-size: 13px;
  font-weight: 800;
}

.coral {
  background: #fee2e2;
  color: #991b1b;
}

.gold {
  background: #fef3c7;
  color: #92400e;
}

.mint {
  background: #dcfce7;
  color: #166534;
}

.chat-meta,
.chat-row,
.friend-meta {
  min-width: 0;
  display: flex;
  flex: 1;
}

.chat-meta,
.friend-meta {
  flex-direction: column;
  gap: 3px;
}

.friend-meta strong,
.chat-row strong {
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-username,
.chat-row,
.inline-status {
  color: var(--muted);
  font-size: 12px;
}

.chat-row {
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

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

.chat-row small {
  flex: 0 0 auto;
  color: #9ca3af;
  font-size: 11px;
}

.unread-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--danger);
  color: #ffffff;
  font-style: normal;
  font-size: 11px;
  font-weight: 800;
}

.main-panel {
  min-height: 0;
  max-height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 12px;
  overflow: hidden;
  padding: 12px;
}

.topbar {
  padding: 12px 14px;
}

.topbar-actions,
.composer-footer,
.composer-meta,
.composer-actions,
.stats-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.topbar-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.presence {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--success);
  color: transparent;
}

.message-board {
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px;
}

.message {
  max-width: min(760px, 78%);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.message.self {
  margin-left: auto;
  flex-direction: row-reverse;
}

.message-body {
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: var(--panel);
  padding: 10px 12px;
}

.message.self .message-body {
  border-color: #bfdbfe;
  background: var(--accent-soft);
}

.message-head {
  margin-bottom: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.message-author {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  padding: 0;
  font: inherit;
  font-weight: 800;
}

.message-author:not(:disabled) {
  cursor: pointer;
}

.message-author:not(:disabled):hover {
  color: var(--accent);
}

.message-author:disabled {
  cursor: default;
}

.message-expiry {
  color: #9ca3af;
}

.message-author-menu {
  position: fixed;
  z-index: 70;
  min-width: 132px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 6px;
}

.message-author-menu-action {
  width: 100%;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  padding: 7px 8px;
  text-align: left;
  font-size: 12px;
  font-weight: 800;
}

.message-author-menu-action:hover {
  background: var(--panel-soft);
}

.message-text {
  color: var(--text);
  line-height: 1.65;
  white-space: pre-wrap;
}

.message-attachments,
.attachment-draft-list {
  display: grid;
  gap: 8px;
}

.message-attachments:empty {
  display: none;
}

.attachment-draft-list {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.attachment-draft {
  border: 1px solid var(--stroke);
  border-radius: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  background: var(--panel-soft);
  padding: 7px 8px;
}

.attachment-draft span,
.message-file span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-draft small,
.message-file small {
  color: var(--muted);
  font-size: 11px;
}

.message-image {
  display: grid;
  gap: 6px;
}

.message-image img {
  max-width: min(320px, 100%);
  max-height: 240px;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  object-fit: cover;
}

.message-file {
  border: 1px solid var(--stroke);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--panel-soft);
  padding: 8px 10px;
}

.message-file a,
.message-image a {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.composer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
}

.composer-footer {
  justify-content: space-between;
}

.ttl-field {
  max-width: 180px;
}

.ttl-inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.ttl-inline span {
  white-space: nowrap;
}

.ttl-picker {
  position: relative;
}

.ttl-trigger {
  min-width: 112px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 7px 10px;
  text-align: left;
  font-size: 13px;
  font-weight: 800;
}

.file-input {
  display: none;
}

.ttl-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  z-index: 8;
  width: min(330px, calc(100vw - 32px));
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 8px;
}

.create-group-form .ttl-menu {
  top: calc(100% + 6px);
  bottom: auto;
}

.ttl-option {
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--muted-strong);
  padding: 7px 8px;
  font-size: 12px;
  font-weight: 800;
}

.ttl-option:hover,
.ttl-option.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.composer-box {
  display: block;
}

.composer textarea {
  min-height: 76px;
  max-height: 150px;
  resize: none;
  line-height: 1.55;
}

.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  border: 1px solid var(--stroke);
  border-radius: 999px;
  color: var(--muted);
  background: var(--panel-soft);
  padding: 5px 9px;
  font-size: 12px;
}

.stats-strip {
  min-height: 24px;
  padding: 0 4px;
  color: var(--muted);
  font-size: 11px;
}

.stats-strip article {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
}

.stats-strip span,
.stats-strip strong {
  overflow: hidden;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-strip strong {
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 800;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.42);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 16px;
}

.group-admin-grid {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.member-overview {
  margin-top: 12px;
}

.admin-block {
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: var(--panel-soft);
  padding: 10px;
}

.admin-block + .admin-block {
  margin-top: 10px;
}

.admin-block-head {
  margin-bottom: 8px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.admin-block-head strong {
  font-size: 13px;
}

.admin-block-head span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  text-align: right;
}

.member-overview-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.group-member-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.group-member-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--stroke);
}

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

.group-member-avatar {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #eef2ff;
  color: #3730a3;
  font-size: 12px;
  font-weight: 800;
}

.group-member-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.group-member-meta strong {
  font-size: 13px;
}

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

.group-member-roles {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.member-badge {
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 700;
}

.member-badge.admin {
  background: var(--accent-soft);
  color: var(--accent);
}

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

.pending-item,
.managed-user-item {
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
}

.pending-meta,
.managed-user-meta {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.pending-meta strong,
.pending-meta span,
.managed-user-meta strong,
.managed-user-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pending-meta strong,
.managed-user-meta strong {
  font-size: 13px;
}

.pending-meta span,
.managed-user-meta span,
.profile-username {
  color: var(--muted);
  font-size: 12px;
}

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

.managed-user-item {
  align-items: stretch;
  flex-direction: column;
}

.managed-user-top,
.managed-user-actions,
.inline-checks {
  display: flex;
  align-items: center;
  gap: 8px;
}

.managed-user-top {
  justify-content: space-between;
}

.managed-user-actions {
  flex-wrap: wrap;
}

.managed-user-actions input {
  max-width: 150px;
  min-height: 28px;
  padding: 5px 8px;
  font-size: 12px;
}

.inline-checks {
  flex-wrap: wrap;
  color: var(--muted-strong);
  font-size: 12px;
}

.inline-checks label {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.inline-checks input {
  width: auto;
}

.mini-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
}

.select-field,
.mention-field {
  position: relative;
}

.search-menu,
.mention-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 5;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 6px;
}

.search-option,
.mention-option {
  width: 100%;
  border-radius: 6px;
  background: transparent;
  padding: 8px 10px;
  text-align: left;
}

.search-option:hover,
.mention-option:hover {
  background: var(--panel-soft);
}

.admin-danger-row {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--stroke);
}

.confirm-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 60;
  border-radius: 8px;
  background: #111827;
  color: #ffffff;
  padding: 9px 12px;
  font-size: 13px;
  box-shadow: var(--shadow);
}

@media (max-width: 1080px) {
  .page-shell {
    width: calc(100% - 16px);
    height: auto;
    min-height: calc(100vh - 16px);
    margin: 8px auto;
  }

  .login-card,
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell {
    height: auto;
  }

  .sidebar,
  .main-panel {
    max-height: none;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    margin: 0;
  }

  .app-shell {
    height: 100dvh;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 0;
  }

  .sidebar,
  .main-panel {
    grid-column: 1;
    grid-row: 1;
    height: 100%;
  }

  .mobile-tabbar {
    grid-column: 1;
    grid-row: 2;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 6px;
    border-top: 1px solid var(--stroke);
    background: var(--panel);
    padding: 8px;
  }

  .mobile-tabbar button {
    min-height: 34px;
    border-radius: 8px;
    background: transparent;
    color: var(--muted-strong);
    font-size: 13px;
    font-weight: 800;
  }

  .mobile-tabbar button.active {
    background: var(--accent-soft);
    color: var(--accent);
  }

  .app-shell[data-mobile-view="chat"] .sidebar,
  .app-shell[data-mobile-view="settings"] .sidebar,
  .app-shell[data-mobile-view="admin"] .sidebar,
  .app-shell[data-mobile-view="chats"] .main-panel,
  .app-shell[data-mobile-view="friends"] .main-panel,
  .app-shell[data-mobile-view="settings"] .main-panel,
  .app-shell[data-mobile-view="admin"] .main-panel,
  .app-shell[data-mobile-view="chats"] .friend-card,
  .app-shell[data-mobile-view="friends"] .chat-card {
    display: none;
  }

  .app-shell[data-mobile-view="chat"] .main-panel {
    display: grid;
  }

  .app-shell[data-mobile-view="settings"] .settings-panel-host,
  .app-shell[data-mobile-view="admin"] .admin-users-panel-host {
    grid-column: 1;
    grid-row: 1;
    min-height: 0;
    display: block;
    overflow: auto;
    background: var(--panel);
    padding: 10px;
  }

  .app-shell[data-mobile-view="chats"] .sidebar,
  .app-shell[data-mobile-view="friends"] .sidebar {
    display: flex;
  }

  .app-shell[data-mobile-view="friends"] .friend-list,
  .app-shell[data-mobile-view="friends"] .friend-list.collapsed {
    display: flex;
  }

  .app-shell[data-mobile-view="friends"] #toggle-friends-button {
    display: none;
  }

  .login-screen,
  .sidebar,
  .main-panel {
    border-radius: 0;
  }

  .login-screen {
    min-height: 100dvh;
    align-content: start;
    padding: 28px 14px;
  }

  .login-card {
    gap: 12px;
  }

  .sidebar {
    min-height: 0;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--stroke);
    overflow: hidden;
    padding: 10px;
  }

  .sidebar > .brand-card {
    display: none;
  }

  .settings-panel > .brand-card #open-account-settings-button {
    display: none;
  }

  .app-shell[data-mobile-view="settings"] .settings-panel > .settings-page-head {
    display: none;
  }

  .chat-card,
  .friend-card {
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .chat-list,
  .friend-list {
    min-height: 0;
    overflow: auto;
  }

  .brand-card,
  .chat-card,
  .friend-card,
  .topbar,
  .composer {
    padding: 10px;
  }

  .brand-card,
  .section-head {
    align-items: flex-start;
  }

  .brand-actions,
  .sidebar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .friend-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .profile-button {
    justify-self: end;
    margin-left: 0;
  }

  .main-panel {
    min-height: 0;
    border-top: 0;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    gap: 8px;
    padding: 10px;
  }

  .mini-form {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    min-width: 0;
    align-items: center;
    flex-direction: row;
  }

  .topbar > div:first-child {
    min-width: 0;
  }

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

  .topbar .eyebrow {
    display: none;
  }

  .topbar-actions {
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
  }

  .topbar-actions .presence {
    display: none;
  }

  .topbar-actions .ghost-button,
  .topbar-actions .danger-button {
    min-height: 30px;
    padding: 6px 8px;
    font-size: 12px;
  }

  .composer-meta,
  .composer-actions,
  .stats-strip {
    align-items: center;
    flex-direction: row;
  }

  .composer-footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
  }

  .composer-meta {
    min-width: 0;
  }

  .composer-actions {
    justify-content: flex-end;
  }

  .mini-form {
    display: flex;
  }

  .message-board {
    min-height: 0;
  }

  .message {
    max-width: 100%;
  }

  .message-avatar {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }

  .composer textarea {
    min-height: 68px;
    max-height: 118px;
  }

  .ttl-field {
    max-width: none;
    min-width: 0;
  }

  .ttl-inline {
    width: 100%;
    display: grid;
    grid-template-columns: auto minmax(88px, 1fr);
    align-items: center;
    gap: 8px;
  }

  .ttl-trigger {
    width: 100%;
    min-width: 0;
    text-align: center;
  }

  .ttl-menu {
    right: auto;
    left: 0;
    width: min(300px, calc(100vw - 20px));
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-strip {
    gap: 4px;
  }

  .modal-shell {
    align-items: end;
    padding: 10px;
  }

  .modal-card {
    width: 100%;
    max-height: calc(100dvh - 20px);
  }
}
