/* static/style.css */
:root {
  color-scheme: dark;

  --bg: #000;
  --surface: #050506;
  --surface-raised: #121214;
  --surface-hover: #1b1b1e;
  --surface-active: #26262a;
  --surface-overlay: rgba(0, 0, 0, 0.86);

  --text: #f5f5f7;
  --text-soft: #d1d1d6;
  --muted: #8e8e93;
  --muted-dark: #5a5a60;

  --line: rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.18);

  --accent: #f7dce8;
  --accent-soft: rgba(247, 220, 232, 0.16);
  --accent-hover: rgba(247, 220, 232, 0.24);
  --accent-active: #fff3f8;

  --success: #30d158;
  --danger: #ff453a;
  --danger-bg: rgba(92, 15, 22, 0.92);
  --danger-soft: rgba(255, 69, 58, 0.18);
  --danger-text: #ffd7d4;

  --shadow: 0 16px 44px rgba(0, 0, 0, 0.68);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.42);

  --radius-xs: 3px;
  --radius-sm: 5px;
  --radius: 7px;
  --radius-lg: 12px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

body.theme-light {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-raised: #f3f3f5;
  --surface-hover: #ebebef;
  --surface-active: #dfdfe4;
  --surface-overlay: rgba(255, 255, 255, 0.82);

  --text: #111214;
  --text-soft: #22252a;
  --muted: #60646b;
  --muted-dark: #81848c;

  --line: rgba(0, 0, 0, 0.10);
  --line-strong: rgba(0, 0, 0, 0.18);

  --accent-active: #151515;
  --shadow: 0 16px 44px rgba(0, 0, 0, 0.12);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.10);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "SF Pro Display",
    "SF Pro Text",
    "Helvetica Neue",
    Helvetica,
    Arial,
    sans-serif;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

button,
label {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
textarea:disabled,
select:disabled,
.disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.hidden {
  display: none !important;
}

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

/* App layout */

.app-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
}

.chat-header {
  z-index: 5;
  flex: 0 0 auto;
  min-height: calc(60px + var(--safe-top));
  padding:
    var(--safe-top)
    max(18px, var(--safe-right))
    0
    max(18px, var(--safe-left));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100%, 980px);
  height: 60px;
  margin: 0 auto;
  gap: 12px;
}

.header-brand {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  min-width: 0;
  gap: 9px;
}

.header-room-copy {
  min-width: 0;
}

.header-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--muted-dark);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.035);
}

.header-dot.online {
  background: var(--success);
  box-shadow: 0 0 10px rgba(48, 209, 88, 0.30);
}

.header-dot.new {
  background: #ffd60a;
  box-shadow: 0 0 10px rgba(255, 214, 10, 0.26);
}

.header-title,
.header-subtitle,
.header-account {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-title {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.header-subtitle {
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.header-navigation {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 4px;
  flex-wrap: nowrap;
}

.header-account-wrap {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 7px;
}

.header-account {
  max-width: 180px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-align: right;
}

.presence-label {
  min-width: 0;
  max-width: 110px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}

/* Header controls */

.header-action,
.feed-button,
.room-select {
  min-height: 30px;
  border: 0;
  outline: none;
  background-color: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  -webkit-font-smoothing: antialiased;
}

.header-action,
.feed-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition:
    background-color 0.16s ease,
    color 0.16s ease,
    opacity 0.16s ease;
}

.header-action {
  min-width: 38px;
  min-height: 38px;
  padding: 0.5rem;
  border-radius: 0.625rem;
}

.feed-button {
  flex: 0 0 auto;
  padding: 0 8px;
  line-height: 30px;
  border-radius: var(--radius-xs);
}

.feed-button.active,
.pages-button.active,
.header-action[aria-pressed="true"],
.header-action.active {
  color: var(--text-soft);
}

.header-action:hover,
.feed-button:hover,
.feed-button.active:hover,
.header-action:focus-visible,
.feed-button:focus-visible {
  color: var(--accent-active);
  background: color-mix(in srgb, var(--text) 8%, transparent);
  box-shadow: none;
}

.header-action:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--text) 28%, transparent);
  outline-offset: 2px;
}

.feed-button:focus-visible,
.room-select:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}

.header-action[aria-pressed="true"],
.header-action.active {
  background: color-mix(in srgb, var(--text) 5%, transparent);
}

.header-action:disabled {
  opacity: 0.5;
  cursor: default;
}

.header-action svg {
  display: block;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  color: inherit;
  overflow: visible;
}

.header-navigation .header-action,
.header-account-wrap .header-action {
  min-width: 38px;
  min-height: 38px;
}

.room-select {
  min-width: 0;
  max-width: 180px;
  padding: 0 24px 0 8px;
  border-radius: var(--radius-xs);
  line-height: 30px;
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position:
    calc(100% - 11px) 13px,
    calc(100% - 7px) 13px;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  cursor: pointer;
  transition: color 120ms ease;
}

.room-select option {
  background: var(--surface-raised);
  color: var(--text);
}

.room-select.active {
  color: var(--text-soft);
}

.room-select:hover,
.room-select.active:hover,
.room-select:focus-visible {
  background-color: transparent;
  color: var(--accent-active);
  box-shadow: none;
}

.room-select:disabled,
.room-select:disabled:hover {
  color: var(--muted-dark);
  cursor: not-allowed;
  opacity: 1;
}

.team-select {
  max-width: 148px;
}

.channel-select {
  max-width: 164px;
}

.team-select,
.channel-select {
  flex: 0 1 auto;
}

/* Shared scrolling containers */

.chat-box,
.feed-box,
.thread-box,
.pages-box,
.page-detail-box,
.profile-box,
.dm-box {
  width: min(100%, 980px);
  flex: 1 1 auto;
  min-height: 0;
  margin: 0 auto;
  padding:
    22px
    max(18px, calc(var(--safe-left) + 18px))
    18px
    max(18px, calc(var(--safe-right) + 18px));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scroll-behavior: smooth;
}

.chat-box::-webkit-scrollbar,
.feed-box::-webkit-scrollbar,
.thread-box::-webkit-scrollbar,
.pages-box::-webkit-scrollbar,
.page-detail-box::-webkit-scrollbar,
.profile-box::-webkit-scrollbar,
.dm-box::-webkit-scrollbar,
.admin-users::-webkit-scrollbar,
.member-list::-webkit-scrollbar,
.reaction-popup-list::-webkit-scrollbar,
.settings-custom-css::-webkit-scrollbar {
  width: 7px;
}

.chat-box::-webkit-scrollbar-thumb,
.feed-box::-webkit-scrollbar-thumb,
.thread-box::-webkit-scrollbar-thumb,
.pages-box::-webkit-scrollbar-thumb,
.page-detail-box::-webkit-scrollbar-thumb,
.profile-box::-webkit-scrollbar-thumb,
.dm-box::-webkit-scrollbar-thumb,
.admin-users::-webkit-scrollbar-thumb,
.member-list::-webkit-scrollbar-thumb,
.reaction-popup-list::-webkit-scrollbar-thumb,
.settings-custom-css::-webkit-scrollbar-thumb {
  border-radius: 99px;
  background: #3a3a3e;
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.empty-card {
  width: min(100%, 360px);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  font-size: 13px;
  line-height: 1.45;
}

.date-separator {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 22px 0 14px;
}

.date-separator span {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

/* Chat messages */

.message-row {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  margin: 8px 0;
  animation: message-in 160ms ease-out both;
}

.message-row.self {
  align-items: flex-end;
}

.message-row.grouped {
  margin-top: 3px;
}

.message-meta {
  display: flex;
  align-items: center;
  max-width: 80%;
  margin: 0 10px 4px;
  gap: 6px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
}

.message-row.self .message-meta {
  justify-content: flex-end;
}

.message-author {
  overflow: hidden;
  color: var(--text-soft);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-author.profile-link,
.feed-entry-author.profile-link,
.profile-link {
  border: 0;
  padding: 0;
  background: transparent;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}

.message-author.profile-link:hover,
.feed-entry-author.profile-link:hover,
.profile-link:hover,
.message-author.profile-link:focus-visible,
.feed-entry-author.profile-link:focus-visible,
.profile-link:focus-visible {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.message-time {
  flex: 0 0 auto;
  color: var(--muted);
  white-space: nowrap;
}

.message-content-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  width: 100%;
}

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

.message-row:not(.self) .message-content-row {
  justify-content: flex-start;
}

.message-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex: 0 0 auto;
  opacity: 0;
  pointer-events: none;
  transform: translateY(2px);
  transition:
    opacity 0.16s ease,
    transform 0.16s ease;
  flex-wrap: wrap;
}

.message-row:hover .message-actions,
.message-row:focus-within .message-actions {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.message-row.self .message-actions {
  justify-content: flex-end;
}

.message-bubble {
  display: block;
  width: fit-content;
  max-width: min(72ch, 78%);
  padding: 0.75rem 0.95rem;
  overflow-wrap: anywhere;
  word-break: break-word;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1rem;
  background: rgba(37, 38, 39, 0.41);
  color: #f3f5f7;
  line-height: 1.42;
  white-space: pre-wrap;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.16);
}

body.theme-light .message-bubble {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
  border-color: rgba(0, 0, 0, 0.08);
}

.message-row:not(.self) .message-bubble {
  border-top-left-radius: 0.4rem;
}

.message-row.self .message-bubble {
  border-top-right-radius: 0.4rem;
  border-top-left-radius: 1rem;
  border-bottom-left-radius: 1rem;
  border-bottom-right-radius: 0.4rem;
  background: rgba(37, 38, 39, 0.61);
  color: #fff;
}

body.theme-light .message-row.self .message-bubble {
  background: rgba(0, 0, 0, 0.10);
  color: var(--text);
}

.message-action,
.admin-delete,
.reaction-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 28px;
  padding: 0.35rem 0.6rem;
  margin: 0;
  border: 0;
  border-radius: 999px;
  outline: none;
  background: rgba(255, 255, 255, 0.06);
  color: #aeb6c2;
  font: inherit;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
  transition:
    background-color 0.16s ease,
    color 0.16s ease,
    opacity 0.16s ease;
}

body.theme-light .message-action,
body.theme-light .admin-delete,
body.theme-light .reaction-trigger {
  background: rgba(0, 0, 0, 0.05);
  color: var(--muted);
}

.message-action:hover,
.message-action:focus-visible,
.admin-delete:hover,
.admin-delete:focus-visible,
.reaction-trigger:hover,
.reaction-trigger:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

body.theme-light .message-action:hover,
body.theme-light .message-action:focus-visible,
body.theme-light .admin-delete:hover,
body.theme-light .admin-delete:focus-visible,
body.theme-light .reaction-trigger:hover,
body.theme-light .reaction-trigger:focus-visible {
  background: rgba(0, 0, 0, 0.08);
  color: var(--text);
}

.message-action:focus-visible,
.admin-delete:focus-visible,
.reaction-trigger:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.25);
  outline-offset: 2px;
}

.admin-delete {
  color: #ff9b9b;
  font-size: 18px;
}

.admin-delete:hover,
.admin-delete:focus-visible {
  background: rgba(255, 80, 80, 0.18);
  color: #fff;
}

.message-attachment {
  display: inline-block;
  margin-top: 8px;
  color: inherit;
  text-decoration: underline;
}

.message-image-link {
  display: block;
  margin-top: 10px;
  max-width: min(360px, 100%);
}

.message-image-preview {
  display: block;
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-raised);
  object-fit: cover;
  box-shadow: var(--shadow-soft);
}

.message-video-preview {
  display: block;
  width: 100%;
  max-width: min(460px, 100%);
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-raised);
  box-shadow: var(--shadow-soft);
}

.message-audio-wrap,
.message-video-wrap {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.message-audio-wrap audio,
.message-video-wrap video,
.message-attachments-list audio {
  width: 100%;
  max-width: min(460px, 100%);
}

.message-url-actions {
  display: flex;
  flex-wrap: wrap;
  margin-top: 10px;
  gap: 6px;
}

.message-row.grouped .message-meta {
  display: none;
}

.message-reactions {
  display: flex;
  flex-wrap: wrap;
  margin-top: 8px;
  gap: 6px;
}

.reaction-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
}

.reaction-chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-active);
}

.reaction-chip:hover,
.reaction-chip:focus-visible {
  border-color: var(--line-strong);
}

/* Feed */

.feed-entry {
  max-width: 100%;
  margin: 10px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.14);
  animation: message-in 160ms ease-out both;
}

.feed-entry.mention {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.feed-entry-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 12px;
}

.feed-room-link {
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--accent-active);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed-room-link:hover,
.feed-room-link:focus-visible {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}

.feed-entry-time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
}

.feed-entry-author {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
}

.feed-entry-body {
  margin-top: 7px;
  overflow-wrap: break-word;
  color: var(--text);
  line-height: 1.45;
  white-space: pre-wrap;
}

.feed-open-room {
  min-height: 30px;
  margin-top: 12px;
}

.feed-entry-reactions {
  display: flex;
  flex-wrap: wrap;
  margin-top: 10px;
  gap: 6px;
}

/* DM list */

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

.dm-card {
  min-height: 0;
}

/* Threads */

.thread-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.thread-label {
  color: var(--text);
  font-size: 15px;
  font-weight: 750;
}

.thread-count {
  color: var(--muted);
  font-size: 12px;
}

.thread-root {
  margin-bottom: 16px;
}

.thread-replies-label {
  margin: 16px 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.thread-message {
  margin: 8px 0;
}

.thread-empty {
  padding: 22px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* Pages */

.pages-header,
.page-detail-header {
  margin-bottom: 18px;
}

.pages-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.pages-header h2,
.page-detail-header h1 {
  margin: 0;
  color: var(--text);
  font-weight: 750;
  letter-spacing: -0.035em;
}

.pages-header h2 {
  font-size: 22px;
}

.page-detail-header h1 {
  margin-top: 10px;
  font-size: clamp(26px, 5vw, 38px);
  line-height: 1.08;
}

.pages-header p,
.page-detail-context {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.page-filters {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 18px;
  gap: 7px;
}

.page-filter {
  min-height: 31px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  outline: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 650;
}

.page-filter:hover,
.page-filter:focus-visible {
  border-color: var(--line-strong);
  color: var(--text-soft);
}

.page-filter.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-active);
}

.pages-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.page-card {
  display: flex;
  flex-direction: column;
  min-height: 180px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  background: var(--surface);
  cursor: pointer;
  transition:
    border-color 120ms ease,
    background-color 120ms ease,
    transform 120ms ease;
}

.page-card:hover,
.page-card:focus-visible {
  border-color: var(--accent);
  background: var(--surface-hover);
  transform: translateY(-1px);
}

.page-card-meta,
.page-detail-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.page-badge {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.page-badge.type {
  background: var(--surface-active);
  color: var(--text-soft);
}

.page-badge.visibility {
  border: 1px solid var(--line);
  color: var(--muted);
}

.page-badge.visibility.public {
  border-color: rgba(48, 209, 88, 0.36);
  background: rgba(48, 209, 88, 0.10);
  color: #85ef9e;
}

.page-badge.visibility.team {
  border-color: rgba(142, 142, 147, 0.32);
  background: rgba(142, 142, 147, 0.10);
  color: var(--text-soft);
}

.page-card h3 {
  margin: 12px 0 7px;
  color: var(--text);
  font-size: 16px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.page-card-excerpt {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.page-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 14px;
  gap: 8px;
  color: var(--muted-dark);
  font-size: 11px;
}

.page-card-footer span,
.page-card-footer time {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-updated {
  color: var(--muted);
  font-size: 12px;
}

.page-body {
  min-height: 180px;
  padding: 20px;
  overflow-wrap: break-word;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.page-detail-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
  gap: 9px;
}

.page-empty-state {
  min-height: 260px;
}

/* Profile view */

.profile-box {
  display: block;
}

.profile-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.profile-banner {
  height: 140px;
  background:
    linear-gradient(135deg, var(--accent-soft), transparent 70%),
    linear-gradient(45deg, color-mix(in srgb, var(--accent) 40%, transparent), transparent 60%),
    var(--surface-active);
}

.profile-content {
  padding: 18px;
}

.profile-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-top: -48px;
}

.profile-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 88px;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--surface-raised);
  color: var(--text);
  font-size: 28px;
  font-weight: 800;
  box-shadow: var(--shadow-soft);
}

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

.profile-name {
  margin: 14px 0 4px;
  color: var(--text);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.profile-handle {
  color: var(--muted);
  font-size: 14px;
}

.profile-badges {
  display: flex;
  flex-wrap: wrap;
  margin-top: 10px;
  gap: 8px;
}

.profile-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
}

.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin-top: 20px;
  gap: 14px;
}

.profile-section {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-raised);
}

.profile-section h3 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}

.profile-bio,
.profile-rendered {
  color: var(--text);
  line-height: 1.55;
  white-space: pre-wrap;
}

.profile-empty {
  color: var(--muted);
  font-style: italic;
}

.profile-meta-list {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 8px 10px;
  color: var(--text-soft);
  font-size: 13px;
}

.profile-meta-list dt {
  color: var(--muted);
  font-weight: 700;
}

.profile-meta-list dd {
  margin: 0;
}

.profile-editor {
  display: grid;
  gap: 10px;
}

.profile-editor textarea.field {
  min-height: 120px;
}

.profile-mode-row,
.settings-theme-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mode-pill,
.theme-pill {
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.mode-pill.active,
.theme-pill.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-active);
}

/* Composer */

.composer-wrap {
  z-index: 5;
  flex: 0 0 auto;
  padding:
    12px
    max(18px, calc(var(--safe-right) + 18px))
    calc(10px + var(--safe-bottom))
    max(18px, calc(var(--safe-left) + 18px));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
}

.composer {
  display: flex;
  align-items: flex-start;
  width: min(100%, 980px);
  gap: 9px;
  margin: 0 auto;
}

.composer-field-wrap {
  flex: 1 1 auto;
  min-width: 0;
}

.composer-input,
.field {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--surface-raised);
  color: var(--text);
}

body.theme-light .composer-input,
body.theme-light .field {
  border-color: rgba(0, 0, 0, 0.12);
}

.composer-input {
  display: block;
  min-height: 44px;
  max-height: 150px;
  padding: 11px 13px;
  resize: none;
  overflow: hidden;
  line-height: 1.35;
}

.composer-input:hover,
.field:hover {
  border-color: rgba(255, 255, 255, 0.28);
}

body.theme-light .composer-input:hover,
body.theme-light .field:hover {
  border-color: rgba(0, 0, 0, 0.20);
}

.composer-input:focus,
.field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.composer-input::placeholder,
.field::placeholder {
  color: var(--muted);
}

.composer-meta {
  display: flex;
  justify-content: space-between;
  min-height: 18px;
  padding: 3px 3px 0;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.attachment-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Shared controls */

.attachment-button,
.send-button,
.button,
.danger-button,
.small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--surface-raised);
  color: var(--text-soft);
  font-family: inherit;
  font-weight: 650;
  transition:
    background-color 120ms ease,
    border-color 120ms ease,
    color 120ms ease;
}

body.theme-light .attachment-button,
body.theme-light .send-button,
body.theme-light .button,
body.theme-light .danger-button,
body.theme-light .small-button {
  border-color: rgba(0, 0, 0, 0.10);
}

.attachment-button,
.send-button {
  height: 44px;
  min-height: 44px;
  align-self: flex-start;
}

.attachment-button {
  width: 44px;
  min-width: 44px;
  flex: 0 0 44px;
  padding: 0 0 1px;
  font-size: 21px;
  line-height: 1;
}

.send-button {
  min-width: 56px;
  flex: 0 0 auto;
  padding: 0 13px;
  font-size: 14px;
  white-space: nowrap;
}

.button,
.danger-button {
  min-height: 40px;
  padding: 0 14px;
}

.small-button {
  min-height: 31px;
  padding: 0 9px;
  font-size: 11px;
}

.attachment-button:hover,
.send-button:hover,
.button:hover,
.small-button:hover {
  border-color: rgba(255, 255, 255, 0.26);
  background: var(--surface-hover);
  color: var(--text);
}

.attachment-button:focus-visible,
.send-button:focus-visible,
.button:focus-visible,
.small-button:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.danger-button {
  border-color: rgba(255, 69, 58, 0.34);
  background: transparent;
  color: #ff9d98;
}

.danger-button:hover,
.small-button.danger:hover {
  border-color: rgba(255, 69, 58, 0.48);
  background: var(--danger-soft);
  color: #ffc0bc;
}

.small-button.danger {
  color: #f1919b;
}

/* Overlays and forms */

.auth-overlay,
.blocked-overlay,
.dialog-overlay,
.reaction-popup-overlay,
.media-overlay,
.header-menu-overlay,
.call-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(20px, var(--safe-top))
    max(20px, var(--safe-right))
    max(20px, var(--safe-bottom))
    max(20px, var(--safe-left));
  overflow: auto;
  background: var(--surface-overlay);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
}

.blocked-overlay {
  z-index: 100;
}

.auth-card,
.dialog-card,
.reaction-popup-card,
.media-card,
.header-menu-card,
.call-card {
  width: min(100%, 400px);
  padding: 24px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-card h1,
.auth-card p {
  text-align: center;
}

.auth-card h1 {
  margin: 0;
  color: var(--text);
  font-size: 25px;
  font-weight: 750;
  letter-spacing: -0.04em;
}

.auth-card p {
  margin: 8px 0 21px;
  color: var(--muted);
  line-height: 1.45;
}

.auth-help {
  margin: 14px 3px 0 !important;
  font-size: 11px;
}

.field {
  min-height: 46px;
  margin: 0 0 10px;
  padding: 11px 13px;
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.button.secondary {
  color: var(--muted);
}

.notice {
  display: none;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.35;
}

.notice.show {
  display: block;
}

.notice.error {
  border: 1px solid rgba(255, 160, 155, 0.22);
  background: var(--danger-bg);
  color: var(--danger-text);
}

/* Header menu / settings */

.header-menu-overlay {
  z-index: 55;
  align-items: flex-start;
  justify-content: flex-end;
  padding-top: calc(var(--safe-top) + 58px);
  padding-right: max(18px, calc(var(--safe-right) + 18px));
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  pointer-events: none;
}

.header-menu-overlay:not(.hidden) {
  pointer-events: auto;
}

.header-menu-card {
  width: min(320px, calc(100vw - 24px));
  padding: 10px;
  border-radius: 16px;
}

.header-menu-title {
  padding: 8px 10px 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.header-menu-list {
  display: grid;
  gap: 4px;
}

.header-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  width: 100%;
  padding: 0 12px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--text-soft);
  text-align: left;
}

.header-menu-item:hover,
.header-menu-item:focus-visible {
  background: var(--surface-hover);
  color: var(--text);
}

.header-menu-item small {
  color: var(--muted);
}

/* Settings view */

.settings-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.settings-section {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.settings-section:last-child {
  border-bottom: 0;
}

.settings-section h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 800;
}

.settings-section p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.settings-row {
  display: grid;
  gap: 10px;
}

.settings-row.inline {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.settings-custom-css {
  min-height: 180px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  resize: vertical;
}

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

.name-color-preview {
  font-size: 16px;
  font-weight: 800;
}

/* Team/room management cards */

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

.manager-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-raised);
}

.manager-card-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.manager-card-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

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

/* Admin */

.admin-fab {
  position: fixed;
  right: max(12px, calc(var(--safe-right) + 12px));
  bottom: calc(74px + var(--safe-bottom));
  z-index: 20;
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  outline: none;
  background: var(--surface-raised);
  color: var(--muted);
  font-size: 18px;
  box-shadow: var(--shadow-soft);
}

.admin-fab.visible {
  display: block;
}

.admin-fab:hover,
.admin-fab:focus-visible {
  border-color: var(--line-strong);
  background: var(--surface-hover);
  color: var(--text);
}

.admin-panel {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.74);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.admin-panel.open {
  display: flex;
}

.admin-sheet {
  display: flex;
  flex-direction: column;
  width: min(860px, 100%);
  max-height: 85dvh;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  background: var(--surface);
  box-shadow: 0 -12px 42px rgba(0, 0, 0, 0.42);
}

.admin-sheet-header,
.admin-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  gap: 10px;
}

.admin-actions {
  flex-wrap: wrap;
  margin: 15px 0;
}

.admin-users,
.admin-rooms {
  min-width: 0;
}

.admin-users {
  flex: 1 1 auto;
  overflow: auto;
  padding-bottom: 16px;
}

.admin-user,
.admin-room {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.admin-user-name,
.admin-room-name {
  overflow: hidden;
  color: var(--text-soft);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-info,
.admin-room-info,
.admin-empty {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.admin-user-actions,
.admin-room-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

/* Dialogs */

.dialog-card {
  width: min(100%, 500px);
}

.dialog-card h2 {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 19px;
  font-weight: 750;
  letter-spacing: -0.03em;
}

.dialog-body p {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.45;
}

.dialog-label {
  display: block;
  margin-top: 10px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 650;
}

.dialog-label .field {
  margin: 6px 0 0;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 18px;
}

.member-list {
  max-height: 220px;
  margin-bottom: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  color: var(--text-soft);
  font-size: 13px;
}

.member-row:last-child {
  border-bottom: 0;
}

/* Accent color picker */

.accent-picker {
  margin-top: 4px;
}

.accent-picker-description {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.accent-picker-label {
  display: block;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
}

.accent-picker-row {
  display: flex;
  align-items: center;
  margin-top: 7px;
  gap: 9px;
}

.accent-color-input {
  width: 48px;
  height: 44px;
  flex: 0 0 48px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--surface-raised);
  cursor: pointer;
}

.accent-color-input:hover,
.accent-color-input:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.accent-hex-input {
  min-width: 0;
  flex: 1 1 auto;
  margin: 0;
  text-transform: lowercase;
}

.accent-preview {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 1px solid rgba(255, 255, 255, 0.30);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.16);
}

.accent-picker-error {
  min-height: 18px;
  margin-top: 7px;
  color: var(--danger-text);
  font-size: 12px;
  line-height: 1.35;
}

/* Reactions popup */

.reaction-popup-overlay {
  z-index: 70;
}

.reaction-popup-card {
  width: min(440px, 100%);
}

.reaction-popup-title {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.reaction-popup-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.reaction-popup-button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-raised);
  color: var(--text);
  font-size: 24px;
}

.reaction-popup-button:hover,
.reaction-popup-button:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.reaction-popup-custom {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 12px;
}

.reaction-custom-input {
  margin: 0;
}

.reaction-popup-list {
  max-height: 220px;
  margin-top: 14px;
  overflow: auto;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.reaction-popup-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding: 0 2px;
  color: var(--text-soft);
  font-size: 13px;
}

/* Media modal */

.media-overlay {
  z-index: 80;
  padding: 18px;
}

.media-card {
  width: min(1100px, 100%);
  max-height: calc(100dvh - 36px);
  padding: 14px;
}

.media-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.media-title {
  min-width: 0;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.media-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
}

.media-body img,
.media-body video {
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 130px);
  border-radius: 12px;
  object-fit: contain;
  background: var(--surface-raised);
}

.media-body audio {
  width: min(100%, 640px);
}

.media-file-fallback {
  display: grid;
  gap: 12px;
  justify-items: center;
  text-align: center;
}

/* Call overlay */

.call-overlay {
  z-index: 85;
}

.call-card {
  width: min(100%, 460px);
}

.call-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.call-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.call-status {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.call-peer-label {
  margin-top: 16px;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 700;
}

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

/* Toasts and live status */

.new-messages-bar {
  position: fixed;
  right: 50%;
  bottom: calc(86px + var(--safe-bottom));
  z-index: 11;
  transform: translateX(50%);
}

.typing-bar {
  position: fixed;
  left: max(18px, calc(var(--safe-left) + 18px));
  bottom: calc(79px + var(--safe-bottom));
  z-index: 15;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
  pointer-events: none;
}

.status-toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + var(--safe-bottom));
  z-index: 60;
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  box-shadow: var(--shadow-soft);
  color: var(--text);
  font-size: 13px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.status-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.status-toast.error {
  border-color: rgba(255, 145, 140, 0.28);
  background: var(--danger-bg);
  color: var(--danger-text);
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (hover: none), (pointer: coarse) {
  .message-actions {
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  .message-bubble {
    max-width: 72%;
  }
}

@media (max-width: 700px) {
  .chat-header {
    min-height: calc(56px + var(--safe-top));
    padding-right: max(12px, var(--safe-right));
    padding-left: max(12px, var(--safe-left));
  }

  .header-inner {
    height: 56px;
    gap: 7px;
  }

  .header-account {
    display: none;
  }

  .header-subtitle {
    display: none;
  }

  .header-navigation {
    gap: 2px;
  }

  .feed-button {
    padding-right: 6px;
    padding-left: 6px;
  }

  .room-select {
    max-width: 130px;
    padding-left: 6px;
  }

  .team-select {
    max-width: 105px;
  }

  .channel-select {
    max-width: 115px;
  }

  .presence-label {
    display: none !important;
  }

  .chat-box,
  .feed-box,
  .thread-box,
  .pages-box,
  .page-detail-box,
  .profile-box,
  .dm-box {
    padding:
      14px
      max(12px, calc(var(--safe-left) + 12px))
      14px
      max(12px, calc(var(--safe-right) + 12px));
  }

  .message-row {
    margin: 6px 0;
  }

  .message-bubble {
    max-width: 84%;
    padding: 9px 12px;
  }

  .message-meta {
    max-width: 84%;
  }

  .feed-entry {
    margin: 8px 0;
    padding: 12px;
  }

  .composer-wrap {
    padding:
      9px
      max(10px, calc(var(--safe-right) + 10px))
      calc(8px + var(--safe-bottom))
      max(10px, calc(var(--safe-left) + 10px));
  }

  .typing-bar {
    left: max(12px, calc(var(--safe-left) + 12px));
    bottom: calc(75px + var(--safe-bottom));
    max-width: calc(100vw - 24px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .admin-sheet {
    width: 100%;
    max-height: 88dvh;
    padding: 14px;
  }

  .admin-user,
  .admin-room,
  .manager-card {
    grid-template-columns: 1fr;
  }

  .admin-user-actions,
  .admin-room-actions,
  .manager-card-actions {
    justify-content: flex-start;
  }

  .pages-header {
    align-items: stretch;
    flex-direction: column;
  }

  .pages-header .button {
    width: 100%;
  }

  .pages-list {
    grid-template-columns: 1fr;
  }

  .page-card {
    min-height: 0;
  }

  .page-body {
    padding: 15px;
  }

  .reaction-popup-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .profile-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .reaction-popup-custom {
    grid-template-columns: 1fr;
  }

  .call-actions {
    flex-direction: column;
  }

  .call-actions > * {
    width: 100%;
  }
}

@media (max-width: 390px) {
  .header-account-wrap {
    display: none;
  }

  .header-navigation {
    flex: 1 1 auto;
    justify-content: flex-end;
  }

  .room-select {
    flex: 1 1 auto;
    width: auto;
    max-width: 118px;
  }

  .team-select {
    max-width: 82px;
  }

  .channel-select {
    max-width: 95px;
  }

  .pages-button,
  #backButton {
    padding-right: 5px;
    padding-left: 5px;
  }

  .message-bubble {
    max-width: 89%;
  }

  .auth-actions {
    grid-template-columns: 1fr;
  }

  .dialog-actions {
    flex-direction: column-reverse;
  }

  .dialog-actions > * {
    width: 100%;
  }

  .accent-picker-row {
    flex-wrap: wrap;
  }

  .accent-hex-input {
    min-width: calc(100% - 57px);
  }
}

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

.load-older-wrap {
  display: flex;
  justify-content: center;
  margin: 4px 0 16px;
}

.message-edited {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  font-style: italic;
}

.message-attachments-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.reaction-popup-section + .reaction-popup-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.profile-rendered h1,
.profile-rendered h2,
.profile-rendered h3 {
  margin: 0.8em 0 0.4em;
}

.markdown-body p,
.profile-rendered p {
  margin: 0.5em 0;
}

.markdown-body pre,
.profile-rendered pre {
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-raised);
}

.markdown-body code,
.profile-rendered code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.markdown-body blockquote,
.profile-rendered blockquote {
  margin: 0.8em 0;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.markdown-body ul,
.markdown-body ol,
.profile-rendered ul,
.profile-rendered ol {
  padding-left: 20px;
}

.composer-wrap.dragover {
  box-shadow: inset 0 0 0 2px var(--accent);
}
