:root {
  color-scheme: light;
  --bg: #f3f5f7;
  --panel: #ffffff;
  --panel-muted: #f7f9fb;
  --text: #18232f;
  --muted: #5b6775;
  --border: #d6dde5;
  --accent: #2166d1;
  --accent-strong: #194ea0;
  --danger: #b43d35;
  --danger-strong: #8f302a;
  --success-bg: #edf7ef;
  --success-border: #b9dcc0;
  --error-bg: #fff0ef;
  --error-border: #efc1bc;
  --badge-bg: rgba(33, 102, 209, 0.12);
  --badge-text: #2166d1;
  --button-text: #ffffff;
  --page-max-width: 800px;
  --radius: 10px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --chat-shell-gradient: linear-gradient(135deg, #d8f1f3 0%, #dfeeff 46%, #cfe5f4 100%);
  --chat-shell-orb-1: rgba(126, 216, 214, 0.52);
  --chat-shell-orb-2: rgba(131, 168, 245, 0.46);
  --chat-shell-orb-3: rgba(163, 213, 255, 0.4);
  --chat-shell-orb-4: rgba(255, 255, 255, 0.42);
  --chat-glass-panel: rgba(255, 255, 255, 0.44);
  --chat-glass-panel-strong: rgba(255, 255, 255, 0.62);
  --chat-glass-panel-soft: rgba(255, 255, 255, 0.36);
  --chat-glass-border: rgba(255, 255, 255, 0.52);
  --chat-glass-divider: rgba(255, 255, 255, 0.58);
  font-family: "Segoe UI Variable Text", "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --panel: #050505;
  --panel-muted: #0d0d0d;
  --text: #f7f7f7;
  --muted: #a8a8a8;
  --border: #1f1f1f;
  --accent: #f4f4f4;
  --accent-strong: #cfcfcf;
  --danger: #f78d84;
  --danger-strong: #e96e64;
  --success-bg: #0d0d0d;
  --success-border: #242424;
  --error-bg: #140f0f;
  --error-border: #5a3531;
  --badge-bg: rgba(255, 255, 255, 0.08);
  --badge-text: #ffffff;
  --button-text: #050505;
  --chat-shell-gradient: linear-gradient(180deg, #000000 0%, #050505 52%, #000000 100%);
  --chat-shell-orb-1: rgba(255, 255, 255, 0.035);
  --chat-shell-orb-2: rgba(255, 255, 255, 0.025);
  --chat-shell-orb-3: rgba(255, 255, 255, 0.02);
  --chat-shell-orb-4: rgba(255, 255, 255, 0.015);
  --chat-glass-panel: rgba(8, 8, 8, 0.74);
  --chat-glass-panel-strong: rgba(12, 12, 12, 0.86);
  --chat-glass-panel-soft: rgba(15, 15, 15, 0.68);
  --chat-glass-border: rgba(255, 255, 255, 0.08);
  --chat-glass-divider: rgba(255, 255, 255, 0.16);
}

* {
  box-sizing: border-box;
}

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

html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

html:has(body.chat-page:not(.archive-page)) {
  height: 100dvh;
  overflow: hidden;
}

html:has(body.archive-page) {
  height: 100dvh;
  overflow: hidden;
}

html:has(body.admin-page.admin-tab-messages) {
  height: 100dvh;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

body.chat-page:not(.archive-page) {
  height: 100dvh;
  overflow: hidden;
  background: var(--chat-shell-gradient);
}

body.archive-page {
  height: 100dvh;
  overflow: hidden;
  background: var(--chat-shell-gradient);
}

body.admin-page {
  background: var(--chat-shell-gradient);
}

body.admin-page.admin-tab-messages {
  height: 100dvh;
  overflow: hidden;
}

body.modal-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

.page-shell {
  width: 100%;
  min-height: 100vh;
  padding: 72px 18px 32px;
}

.chat-page:not(.archive-page) .page-shell {
  height: 100dvh;
  min-height: 100dvh;
  padding: 50px 18px;
  overflow: hidden;
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(circle at 12% 18%, var(--chat-shell-orb-1) 0, transparent 28%),
    radial-gradient(circle at 86% 14%, var(--chat-shell-orb-2) 0, transparent 24%),
    radial-gradient(circle at 84% 82%, var(--chat-shell-orb-3) 0, transparent 28%),
    radial-gradient(circle at 22% 78%, var(--chat-shell-orb-4) 0, transparent 24%),
    var(--chat-shell-gradient);
}

.archive-page .page-shell {
  height: 100dvh;
  min-height: 100dvh;
  padding: 50px 18px;
  overflow: hidden;
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(circle at 12% 18%, var(--chat-shell-orb-1) 0, transparent 28%),
    radial-gradient(circle at 86% 14%, var(--chat-shell-orb-2) 0, transparent 24%),
    radial-gradient(circle at 84% 82%, var(--chat-shell-orb-3) 0, transparent 28%),
    radial-gradient(circle at 22% 78%, var(--chat-shell-orb-4) 0, transparent 24%),
    var(--chat-shell-gradient);
}

.login-page .page-shell {
  min-height: 100dvh;
  padding: 50px 18px;
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(circle at 12% 18%, var(--chat-shell-orb-1) 0, transparent 28%),
    radial-gradient(circle at 86% 14%, var(--chat-shell-orb-2) 0, transparent 24%),
    radial-gradient(circle at 84% 82%, var(--chat-shell-orb-3) 0, transparent 28%),
    radial-gradient(circle at 22% 78%, var(--chat-shell-orb-4) 0, transparent 24%),
    var(--chat-shell-gradient);
}

.admin-page .page-shell {
  min-height: 100vh;
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(circle at 12% 18%, var(--chat-shell-orb-1) 0, transparent 28%),
    radial-gradient(circle at 86% 14%, var(--chat-shell-orb-2) 0, transparent 24%),
    radial-gradient(circle at 84% 82%, var(--chat-shell-orb-3) 0, transparent 28%),
    radial-gradient(circle at 22% 78%, var(--chat-shell-orb-4) 0, transparent 24%),
    var(--chat-shell-gradient);
}

.admin-page.admin-tab-messages .page-shell {
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
}

.page-width {
  width: min(var(--page-max-width), 100%);
  margin: 0 auto;
}

.chat-page:not(.archive-page) .page-width {
  height: calc(100dvh - 100px);
  min-height: calc(100dvh - 100px);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.archive-page .page-width {
  height: calc(100dvh - 100px);
  min-height: calc(100dvh - 100px);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.login-page .page-width {
  min-height: calc(100dvh - 100px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.admin-page.admin-tab-messages .page-width {
  height: calc(100dvh - 104px);
  min-height: calc(100dvh - 104px);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.admin-page {
  --page-max-width: 1200px;
}

.page-width-narrow {
  width: 100%;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  margin-bottom: 20px;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  justify-content: flex-end;
}

.topbar .eyebrow {
  margin: 0;
}

.topbar-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
}

body.chat-page .topbar-menu-toggle {
  display: none;
}

.topbar-menu-toggle__icon {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.topbar-menu-toggle__icon::before,
.topbar-menu-toggle__icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.topbar-menu-toggle__icon::before {
  top: -6px;
}

.topbar-menu-toggle__icon::after {
  top: 6px;
}

.site-menu[hidden] {
  display: none !important;
}

.site-menu {
  position: fixed;
  inset: 0;
  z-index: 45;
}

.site-menu__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 16, 24, 0.4);
  opacity: 0;
  transition: opacity 220ms ease;
}

.site-menu__panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(360px, 86vw);
  height: 100%;
  padding: 26px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--chat-glass-panel-strong);
  border-left: 1px solid var(--chat-glass-border);
  box-shadow: -20px 0 46px rgba(87, 141, 202, 0.16);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  transform: translateX(102%);
  transition: transform 220ms ease;
}

.site-menu.is-open .site-menu__backdrop {
  opacity: 1;
}

.site-menu.is-open .site-menu__panel {
  transform: translateX(0);
}

.site-menu__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--chat-glass-divider);
}

.site-menu__header .eyebrow {
  margin: 0;
}

.site-menu__actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.site-menu__actions .button,
.site-menu__actions .button-secondary {
  width: 100%;
  justify-content: center;
}

.admin-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 0;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.admin-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
  margin-left: auto;
}

.admin-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(138, 185, 235, 0.78);
  color: #4f7fbe;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.admin-tab:hover {
  background: rgba(240, 248, 255, 0.98);
  border-color: rgba(113, 167, 229, 0.9);
  color: #3f6fae;
}

.admin-tab.is-active {
  border-color: rgba(91, 177, 221, 0.92);
  background: linear-gradient(135deg, #69afff 0%, #59c8cf 100%);
  color: #ffffff;
}

.title-group h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.subtitle {
  max-width: 58ch;
  margin: 10px 0 0;
  color: var(--muted);
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.card-chat {
  border-radius: var(--radius);
  padding: 22px;
}

.chat-page:not(.archive-page) .card-chat {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--chat-glass-panel);
  border-color: var(--chat-glass-border);
  backdrop-filter: blur(22px) saturate(145%);
  -webkit-backdrop-filter: blur(22px) saturate(145%);
}

.archive-page .card-chat {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--chat-glass-panel);
  border-color: var(--chat-glass-border);
  backdrop-filter: blur(22px) saturate(145%);
  -webkit-backdrop-filter: blur(22px) saturate(145%);
}

.login-page .card-chat {
  width: 100%;
  background: var(--chat-glass-panel);
  border-color: var(--chat-glass-border);
  backdrop-filter: blur(22px) saturate(145%);
  -webkit-backdrop-filter: blur(22px) saturate(145%);
}

.admin-page .card-chat {
  background: var(--chat-glass-panel-strong);
  border-color: var(--chat-glass-border);
  box-shadow: 0 24px 60px rgba(97, 153, 214, 0.14);
  backdrop-filter: blur(24px) saturate(155%);
  -webkit-backdrop-filter: blur(24px) saturate(155%);
}

.admin-page.admin-tab-messages .admin-panel-messages {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.card-heading h2,
.section-block h3 {
  margin: 0;
  font-size: 1.15rem;
}

html:not([data-theme="dark"]) body.admin-page .card-heading h2,
html:not([data-theme="dark"]) body.admin-page .section-block h3,
html:not([data-theme="dark"]) body.admin-page .admin-settings-inline-section h3 {
  color: #4f6787;
}

html[data-theme="dark"] body.admin-page .card-heading h2,
html[data-theme="dark"] body.admin-page .section-block h3,
html[data-theme="dark"] body.admin-page .admin-settings-inline-section h3 {
  color: #cfd5de;
}

html[data-theme="dark"] body.admin-page .admin-tab {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: #cfd5de;
}

html[data-theme="dark"] body.admin-page .admin-tab:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

html[data-theme="dark"] body.admin-page .admin-tab.is-active {
  border-color: rgba(255, 255, 255, 0.38);
  background: linear-gradient(180deg, #ffffff 0%, #d7d7d7 100%);
  color: #050505;
}

.admin-settings-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 1px minmax(260px, 340px);
  gap: 20px;
  align-items: start;
}

.admin-settings-split--equal {
  grid-template-columns: minmax(0, 1fr) 1px minmax(0, 1fr);
}

.admin-settings-split--triple {
  grid-template-columns: minmax(0, 1fr) 1px minmax(0, 1fr) 1px minmax(0, 1fr);
}

.admin-settings-split__section {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.admin-settings-split__divider {
  width: 1px;
  align-self: stretch;
  background: var(--border);
}

.admin-settings-split__section-status {
  align-content: start;
}

.admin-settings-inline-section {
  display: grid;
  gap: 12px;
  margin-top: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.admin-settings-inline-section h3,
.admin-settings-inline-section p {
  margin: 0;
}

.bbcode-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.bbcode-picker__list {
  min-width: 0;
  justify-self: stretch;
}

.bbcode-picker__select {
  width: 100%;
  height: 220px;
  min-height: 220px;
  max-height: 220px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-muted);
  color: var(--text);
  padding: 8px;
  outline: none;
  appearance: auto;
  -webkit-appearance: listbox;
  -moz-appearance: listbox;
  background-image: none;
}

.bbcode-picker__select:focus {
  border-color: var(--accent);
}

.bbcode-picker__select option {
  padding: 6px 8px;
}

.bbcode-picker__actions {
  display: grid;
  gap: 10px;
  justify-items: center;
}

.bbcode-picker__move.button {
  min-width: 44px;
  padding: 0 10px;
}

.avatars-settings-form {
  gap: 18px;
  margin-block: 14px 0;
}

.avatars-directory-field {
  min-width: 0;
}

.avatars-directory-path {
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.avatars-settings-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 1px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.avatars-settings-split__panel {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.avatars-settings-split__panel p {
  margin: 0;
}

.avatars-settings-split__panel .field {
  margin-top: 2px;
}

.avatars-settings-split__divider {
  width: 1px;
  align-self: stretch;
  background: var(--border);
}

.avatars-rotation-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 16px;
  align-items: end;
}

.avatars-rotation-field {
  min-width: 0;
}

.avatars-settings-form__actions {
  justify-content: center;
  padding-top: 8px;
}

.avatar-upload-form {
  gap: 16px;
  margin-block: 14px 0;
}

.avatar-upload-grid {
  display: grid;
  grid-template-columns: var(--avatar-upload-preview-size) 1px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  --avatar-upload-preview-size: 164px;
}

.avatar-upload-workspace,
.avatar-upload-preview {
  display: grid;
  gap: 16px;
  align-content: start;
  min-width: 0;
}

.avatar-upload-grid__divider {
  width: 1px;
  align-self: stretch;
  background: var(--border);
}

.avatar-upload-workspace__file-field {
  gap: 0;
}

.avatar-cropper {
  display: grid;
  gap: 10px;
  width: var(--avatar-upload-preview-size);
}

.avatar-cropper__stage {
  position: relative;
  width: var(--avatar-upload-preview-size);
  max-width: none;
  justify-self: start;
  height: var(--avatar-upload-preview-size);
  min-height: var(--avatar-upload-preview-size);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-muted);
  overflow: hidden;
  touch-action: none;
}

.avatar-cropper__canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

.avatar-cropper__canvas.is-dragging {
  cursor: grabbing;
}

.avatar-cropper__controls {
  display: grid;
  gap: 0;
  width: var(--avatar-upload-preview-size);
}

.avatar-cropper__zoom {
  width: var(--avatar-upload-preview-size);
}

.avatar-upload-preview__frame {
  display: grid;
  gap: 12px;
  min-height: var(--avatar-upload-preview-size);
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-muted);
  box-sizing: border-box;
  align-content: start;
}

.avatar-upload-preview__label {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
}

.avatar-upload-preview__message {
  margin: 0;
  background: var(--panel);
  display: grid;
  grid-template-columns: 52px 1px minmax(0, 1fr);
  align-items: stretch;
  column-gap: 18px;
}

.avatar-upload-form__actions {
  display: flex;
  width: 100%;
  margin-top: 16px;
  grid-column: 1 / -1;
  justify-content: center;
  align-items: center;
  justify-self: stretch;
}

.avatar-upload-form__actions .button {
  width: auto;
}

.avatar-library__preview-column {
  width: 104px;
}

.avatar-library__date-column {
  width: 200px;
}

.avatar-library__thumb {
  display: block;
  width: 56px;
  height: 56px;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: 50%;
  object-fit: cover;
  background: var(--panel);
}

.avatar-library__file-name {
  text-align: left !important;
  overflow-wrap: anywhere;
}

.card-heading p,
.section-block p {
  margin: 6px 0 0;
  color: var(--muted);
}

.admin-panel-avatars .section-block > p {
  margin-bottom: 14px;
}

.admin-inline-field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}

.admin-inline-field-row__toggle {
  align-self: center;
}

.chat-feed {
  display: flex;
  flex-direction: column;
  gap: 13px;
  min-height: 420px;
  max-height: min(650px, calc(100vh - 320px));
  overflow-y: auto;
  padding: 8px 9px 8px 0;
}

.chat-page:not(.archive-page) .chat-feed {
  flex: 1 1 auto;
  min-height: 280px;
  max-height: none;
}

.chat-page:not(.archive-page) .chat-message {
  background: var(--chat-glass-panel-soft);
  border-color: var(--chat-glass-border);
  backdrop-filter: blur(20px) saturate(135%);
  -webkit-backdrop-filter: blur(20px) saturate(135%);
}

.chat-page:not(.archive-page) .chat-message__divider,
.chat-page:not(.archive-page) .chat-date-divider__line {
  background: var(--chat-glass-divider);
}

.chat-page:not(.archive-page) .composer-editor {
  background: var(--chat-glass-panel-strong);
  border-color: var(--chat-glass-border);
  backdrop-filter: blur(22px) saturate(145%);
  -webkit-backdrop-filter: blur(22px) saturate(145%);
}

.chat-page:not(.archive-page) .composer-side {
  border-left-color: var(--chat-glass-divider);
}

.chat-page:not(.archive-page) .composer-editor .character-counter {
  background: transparent;
}

.chat-page:not(.archive-page) .modal__dialog {
  background: var(--chat-glass-panel-strong);
  border-color: var(--chat-glass-border);
  backdrop-filter: blur(24px) saturate(155%);
  -webkit-backdrop-filter: blur(24px) saturate(155%);
}

.archive-page .chat-feed {
  flex: 1 1 auto;
  min-height: 280px;
  max-height: none;
}

.archive-page .chat-message {
  background: var(--chat-glass-panel-soft);
  border-color: var(--chat-glass-border);
  backdrop-filter: blur(20px) saturate(135%);
  -webkit-backdrop-filter: blur(20px) saturate(135%);
}

.archive-page .chat-message__divider,
.archive-page .chat-date-divider__line {
  background: var(--chat-glass-divider);
}

.archive-page .modal__dialog {
  background: var(--chat-glass-panel-strong);
  border-color: var(--chat-glass-border);
  backdrop-filter: blur(24px) saturate(155%);
  -webkit-backdrop-filter: blur(24px) saturate(155%);
}

.admin-page.admin-tab-messages .admin-panel-body-feed {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-page.admin-tab-messages .admin-feed {
  flex: 1 1 auto;
  min-height: 280px;
  max-height: none;
  padding-bottom: 50px;
}

@media (max-height: 760px) {
  html:has(body.chat-page:not(.archive-page)) {
    height: auto;
    overflow-y: scroll;
  }

  html:has(body.archive-page) {
    height: auto;
    overflow-y: scroll;
  }

  html:has(body.admin-page.admin-tab-messages) {
    height: auto;
    overflow-y: scroll;
  }

  body.chat-page:not(.archive-page) {
    height: auto;
    overflow: auto;
  }

  body.archive-page {
    height: auto;
    overflow: auto;
  }

  body.admin-page.admin-tab-messages {
    height: auto;
    overflow: auto;
  }

  .chat-page:not(.archive-page) .page-shell {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .archive-page .page-shell {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .admin-page.admin-tab-messages .page-shell {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .chat-page:not(.archive-page) .page-width {
    height: auto;
    min-height: calc(100dvh - 100px);
  }

  .archive-page .page-width {
    height: auto;
    min-height: calc(100dvh - 100px);
  }

  .admin-page.admin-tab-messages .page-width {
    height: auto;
    min-height: calc(100dvh - 104px);
  }

  .chat-page:not(.archive-page) .card-chat {
    min-height: 560px;
    overflow: visible;
  }

  .archive-page .card-chat {
    min-height: 560px;
    overflow: visible;
  }

  .admin-page.admin-tab-messages .admin-panel-messages {
    min-height: 560px;
    overflow: visible;
  }

  .chat-page:not(.archive-page) .chat-feed {
    min-height: 280px;
    max-height: none;
  }

  .archive-page .chat-feed {
    min-height: 280px;
    max-height: none;
  }

  .admin-page.admin-tab-messages .admin-panel-body-feed {
    min-height: 0;
    overflow: visible;
  }

  .admin-page.admin-tab-messages .admin-feed {
    min-height: 280px;
    max-height: none;
  }
}

.admin-panel-body {
  padding-right: 9px;
}

.admin-panel-body-feed {
  min-height: 420px;
}

.admin-messages-controls {
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.admin-messages-controls__row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 16px;
  align-items: end;
}

.admin-messages-controls__search {
  width: 100%;
  margin-bottom: 16px;
}

.admin-messages-controls__actions {
  display: flex;
  align-items: end;
  gap: 12px;
}

.admin-messages-controls__actions .button {
  white-space: nowrap;
}

.admin-panel-body-form {
  min-height: 420px;
}

.chat-date-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 3px 0;
  color: var(--muted);
}

.chat-date-divider__line {
  flex: 1 1 auto;
  height: 1px;
  background: var(--border);
}

.chat-date-divider__label {
  flex: 0 0 auto;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.chat-message {
  background: var(--panel-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.chat-page .chat-feed .chat-message {
  display: grid;
  grid-template-columns: 52px 1px minmax(0, 1fr);
  align-items: stretch;
  column-gap: 18px;
  border-radius: var(--radius);
}

.chat-no-avatars .chat-feed .chat-message {
  grid-template-columns: minmax(0, 1fr);
}

.chat-no-avatars .admin-feed .chat-message {
  grid-template-columns: minmax(0, 1fr) 1px auto;
}

.chat-no-avatars .chat-feed .chat-message > .chat-avatar,
.chat-no-avatars .chat-feed .chat-message > .chat-avatar + .chat-message__divider {
  display: none;
}

.chat-no-dates .chat-date-divider {
  display: none;
}

.admin-feed .chat-message {
  display: grid;
  grid-template-columns: 52px 1px minmax(0, 1fr) 1px auto;
  align-items: stretch;
  column-gap: 18px;
  border-radius: var(--radius);
}

.chat-message__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

.chat-page .chat-feed .chat-message__meta {
  display: none;
}

.chat-message__status {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8rem;
  line-height: 1;
  color: var(--muted);
}

.chat-message__ip {
  margin-left: auto;
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 0.84rem;
  white-space: nowrap;
}

.chat-avatar {
  width: 52px;
  min-width: 52px;
  height: 52px;
  border: 1px solid var(--avatar-border, var(--border));
  border-radius: 999px;
  background: var(--avatar-bg, var(--panel));
  position: relative;
  align-self: start;
}

.chat-avatar--default {
  --avatar-bg: var(--avatar-bg-light, var(--panel));
  --avatar-border: var(--avatar-border-light, var(--border));
  --avatar-fill: var(--avatar-fill-light, var(--muted));
}

.chat-avatar--image {
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.chat-avatar--image .chat-avatar__head,
.chat-avatar--image .chat-avatar__body {
  display: none;
}

.chat-avatar__head,
.chat-avatar__body {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: var(--avatar-fill, var(--muted));
}

.chat-avatar__head {
  top: 11px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
}

.chat-avatar__body {
  bottom: 10px;
  width: 26px;
  height: 14px;
  border-radius: 14px 14px 10px 10px;
}

.chat-message__divider {
  width: 1px;
  height: 100%;
  min-height: 52px;
  background: var(--border);
}

.chat-message__content {
  min-width: 0;
  display: grid;
  align-content: center;
}

.chat-message__body {
  margin: 0;
  font-size: 1rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-embed {
  width: 100%;
  margin: 12px 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #000;
}

.chat-message__body > .chat-embed:first-child {
  margin-top: 0;
}

.chat-message__body > .chat-embed:last-child {
  margin-bottom: 0;
}

.chat-embed iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
}

.chat-embed--spotify {
  background: #121212;
}

.chat-embed--spotify iframe {
  aspect-ratio: auto;
}

.chat-embed--spotify-compact iframe {
  min-height: 152px;
}

.chat-embed--spotify-full iframe {
  min-height: 352px;
}

.chat-embed--x {
  background: transparent;
}

.chat-embed--x .twitter-tweet {
  margin: 0 auto !important;
  width: 100% !important;
}

.chat-embed--x iframe {
  aspect-ratio: auto;
  min-height: 320px;
  background: #fff;
}

.chat-inline-image {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  object-fit: contain;
}

.chat-inline-image-link {
  display: block;
  width: 100%;
  margin: 12px 0;
}

.chat-message__body > .chat-inline-image-link:first-child {
  margin-top: 0;
}

.chat-message__body > .chat-inline-image-link:last-child {
  margin-bottom: 0;
}

.chat-bbcode-underline {
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.chat-bbcode-quote {
  margin: 12px 0;
  padding: 10px 12px 10px 14px;
  border-left: 2px solid var(--accent);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.58);
  display: grid;
  gap: 6px;
}

.chat-bbcode-quote__label {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.chat-bbcode-quote__body {
  min-width: 0;
}

.chat-bbcode-code {
  position: relative;
  margin: 12px 0;
  padding: 38px 14px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  overflow-x: auto;
}

.chat-bbcode-code__pre {
  margin: 0;
}

.chat-bbcode-code code {
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 0.92rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-bbcode-code__copy.button {
  position: absolute;
  top: 8px;
  right: 8px;
  min-height: 24px;
  height: 24px;
  padding: 0 8px;
  font-size: 0.78rem;
  line-height: 1;
  white-space: nowrap;
}

.chat-bbcode-spoiler {
  margin: 12px 0;
  border: 1px solid rgba(140, 191, 235, 0.48);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.58);
  overflow: hidden;
}

.chat-bbcode-spoiler summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  font-weight: 700;
  color: #4f7fbe;
  background: rgba(255, 255, 255, 0.38);
}

.chat-bbcode-spoiler summary::-webkit-details-marker {
  display: none;
}

.chat-bbcode-spoiler summary::after {
  content: '';
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 140ms ease;
}

.chat-bbcode-spoiler[open] summary::after {
  transform: rotate(225deg);
}

.chat-bbcode-spoiler[open] summary {
  border-bottom: 1px solid rgba(140, 191, 235, 0.38);
}

.chat-bbcode-spoiler__content {
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.28);
}

.chat-bbcode-spoiler__summary-label {
  min-width: 0;
}

.chat-bbcode-align {
  margin: 12px 0;
}

.chat-bbcode-align--left {
  text-align: left;
}

.chat-bbcode-align--center {
  text-align: center;
}

.chat-bbcode-align--right {
  text-align: right;
}

.chat-bbcode-list {
  margin: 12px 0;
  padding-left: 22px;
}

.chat-bbcode-list li + li {
  margin-top: 6px;
}

.chat-bbcode-hr {
  margin: 16px 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.chat-message__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.chat-message__actions .button {
  width: auto;
}

.chat-message__action-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-message__delete-form {
  display: grid;
  align-content: center;
}

.chat-message__ban-form {
  display: grid;
  align-content: center;
}

.message-select {
  display: grid;
  align-content: center;
  padding-left: 10px;
  padding-right: 10px;
  margin-left: 10px;
  border-left: 1px solid var(--border);
}

.message-select__input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 0.86rem;
  font-weight: 700;
}

.chat-composer {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 14px;
}

.chat-closed .composer-editor,
.chat-banned .composer-editor,
.chat-timeout .composer-editor {
  background: var(--bg);
}

.chat-closed .composer-editor textarea,
.chat-closed .composer-submit,
.chat-banned .composer-editor textarea,
.chat-banned .composer-submit,
.chat-timeout .composer-editor textarea,
.chat-timeout .composer-submit {
  cursor: not-allowed;
}

.composer-row {
  width: 100%;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-muted);
  color: var(--text);
  padding: 16px 18px;
  outline: none;
  transition: border-color 140ms ease;
}

.field select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  padding-right: 52px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text) 50%),
    linear-gradient(135deg, var(--text) 50%, transparent 50%);
  background-position:
    calc(100% - 24px) calc(50% - 1px),
    calc(100% - 18px) calc(50% - 1px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.field select::-ms-expand {
  display: none;
}

.bbcode-picker .bbcode-picker__select[multiple] {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: none;
  padding-right: 8px;
}

.settings-select-host {
  width: 100%;
}

.settings-select {
  position: relative;
}

.settings-select__trigger {
  width: 100%;
  min-height: 56px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-muted);
  color: var(--text);
  padding: 16px 20px;
  padding-right: 52px;
  text-align: left;
  position: relative;
}

.settings-select__trigger:focus-visible,
.settings-select.is-open .settings-select__trigger {
  border-color: var(--accent);
  outline: none;
}

.settings-select__value {
  display: block;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-select__icon {
  position: absolute;
  top: 50%;
  right: 20px;
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-65%) rotate(45deg);
  transition: transform 140ms ease;
}

.settings-select.is-open .settings-select__icon {
  transform: translateY(-35%) rotate(225deg);
}

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

.settings-select__menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 10px;
  right: 10px;
  z-index: 20;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 8px;
}

.settings-select__list {
  max-height: 320px;
  overflow: auto;
  display: grid;
  gap: 8px;
}

.settings-select__group {
  display: grid;
  gap: 4px;
}

.settings-select__group + .settings-select__group {
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.settings-select__group-label {
  padding: 2px 10px 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.settings-select__option {
  width: 100%;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
  font-weight: 500;
}

.settings-select__option:hover {
  background: var(--panel-muted);
}

.settings-select__option:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0;
}

.settings-select__option.is-selected {
  background: var(--accent);
  color: var(--button-text);
}

.settings-select__option.is-selected:hover {
  background: var(--accent-strong);
}

.composer-editor {
  --composer-side-width: 86px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-muted);
  position: relative;
  overflow: hidden;
  transition: border-color 140ms ease;
}

.composer-editor textarea {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 128px;
  border: 0;
  background: transparent;
  color: transparent;
  caret-color: var(--text);
  font: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  padding: 16px 128px 16px 50px;
  resize: none;
  outline: none;
  z-index: 1;
}

.composer-editor textarea::placeholder {
  color: var(--muted);
}

.composer-highlight {
  min-height: 128px;
  width: 100%;
  margin: 0;
  padding: 16px 128px 16px 50px;
  color: var(--text);
  font: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  overflow: auto;
  pointer-events: none;
  z-index: 0;
}

.composer-highlight::-webkit-scrollbar {
  display: none;
}

.chat-page .composer-editor .composer-help-button.button {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 5;
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1;
  pointer-events: auto;
}

.composer-side {
  position: absolute;
  top: 12px;
  right: 18px;
  bottom: 12px;
  width: var(--composer-side-width);
  display: grid;
  grid-template-rows: auto 1fr;
  justify-items: stretch;
  padding-left: 14px;
  border-left: 1px solid var(--border);
  z-index: 2;
}

.composer-editor .character-counter {
  width: 100%;
  padding: 0;
  margin: 0;
  background: var(--panel-muted);
  pointer-events: none;
  text-align: center;
}

.composer-submit {
  position: static;
  align-self: center;
  justify-self: center;
  width: 72px;
  min-width: 72px;
  padding: 0;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transform: none;
  border-color: transparent;
  background: linear-gradient(135deg, #66a8ff 0%, #5ec4d3 100%);
  color: #ffffff;
}

.composer-submit:hover:not(:disabled) {
  background: linear-gradient(135deg, #5a9df6 0%, #54b9c8 100%);
  color: #ffffff;
}

.composer-side .character-counter[hidden] + .composer-submit {
  grid-row: 1 / -1;
  align-self: center;
}

.composer-submit.is-countdown-compact {
  font-size: 0.88rem;
}

.composer-submit.is-countdown-tight {
  font-size: 0.76rem;
}

.composer-editor:focus-within,
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
}

.composer-editor.is-over-limit {
  border-color: var(--danger);
}

.composer-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.composer-footer,
.form-actions,
.inline-actions,
.message-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.avatars-settings-form__actions.form-actions {
  justify-content: center;
  align-items: center;
  width: 100%;
}

.avatar-upload-form__actions {
  justify-content: center;
  width: 100%;
}

.avatar-upload-form__actions .button {
  margin-left: 0;
}

.message-actions {
  margin-top: 16px;
}

.helper-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.helper-text-error {
  color: var(--danger);
}

.character-counter {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}

.character-counter.is-over-limit {
  color: var(--danger);
  font-weight: 700;
}

.over-limit-text {
  color: var(--danger);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--button-text);
  font-weight: 700;
}

.button:hover {
  background: var(--accent-strong);
}

.button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.button-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.button-secondary:hover {
  background: var(--panel-muted);
}

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

.button-danger:hover {
  background: var(--danger-strong);
}

.chat-message__delete-button.button {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: var(--radius-xs);
  font-size: 0.72rem;
  line-height: 1;
}

.chat-message__ban-button.button {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0;
  border-radius: var(--radius-xs);
  font-size: 0;
  line-height: 1;
}

.chat-message__ban-button.button::before,
.chat-message__ban-button.button::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.chat-message__ban-button.button::before {
  width: 8px;
  height: 8px;
  border: 1.5px solid #fff;
  border-radius: 50%;
  box-sizing: border-box;
}

.chat-message__ban-button.button::after {
  width: 1.5px;
  height: 10px;
  background: #fff;
  transform: translate(-50%, -50%) rotate(45deg);
  border-radius: 999px;
}

.admin-feed-toolbar[hidden] {
  display: none;
}

.admin-feed-toolbar {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.admin-feed-toolbar > form,
.admin-feed-toolbar > button {
  display: flex;
}

.admin-feed-toolbar > form[hidden],
.admin-feed-toolbar > button[hidden] {
  display: none !important;
}

.admin-feed-toolbar > form > .button,
.admin-feed-toolbar > button {
  min-width: 148px;
  justify-content: center;
}

.admin-page .button[hidden] {
  display: none !important;
}

.admin-page .button:not(.chat-message__delete-button),
.admin-page .button-secondary:not(.chat-message__delete-button),
.admin-page .button-danger:not(.chat-message__delete-button) {
  min-height: 34px;
  padding: 0 11px;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0;
  width: auto;
  white-space: nowrap;
}

.admin-page .chat-message__delete-button.button {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 0.72rem;
  line-height: 1;
}

.admin-page .chat-message__ban-button.button {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0;
  font-size: 0;
  line-height: 1;
}

.chat-page .button:not(.composer-submit),
.login-page .button,
.chat-page .button-secondary:not(.composer-submit),
.login-page .button-secondary,
.chat-page .button-danger:not(.composer-submit) {
  min-height: 34px;
  padding: 0 11px;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0;
  width: auto;
  white-space: nowrap;
}

html:not([data-theme="dark"]) body.chat-page:not(.archive-page) .button:not(.composer-submit),
html:not([data-theme="dark"]) body.chat-page:not(.archive-page) .button-secondary:not(.composer-submit),
html:not([data-theme="dark"]) body.login-page .button-secondary,
html:not([data-theme="dark"]) body.admin-page .button-secondary,
html:not([data-theme="dark"]) body.archive-page .button:not(.composer-submit),
html:not([data-theme="dark"]) body.archive-page .button-secondary:not(.composer-submit) {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(138, 185, 235, 0.78);
  color: #4f7fbe;
}

html:not([data-theme="dark"]) body.chat-page:not(.archive-page) .button:not(.composer-submit):hover,
html:not([data-theme="dark"]) body.chat-page:not(.archive-page) .button-secondary:not(.composer-submit):hover,
html:not([data-theme="dark"]) body.login-page .button-secondary:hover,
html:not([data-theme="dark"]) body.admin-page .button-secondary:hover,
html:not([data-theme="dark"]) body.archive-page .button:not(.composer-submit):hover,
html:not([data-theme="dark"]) body.archive-page .button-secondary:not(.composer-submit):hover {
  background: rgba(240, 248, 255, 0.98);
  border-color: rgba(113, 167, 229, 0.9);
  color: #3f6fae;
}

body.chat-page:not(.archive-page) .composer-submit {
  border-color: rgba(91, 177, 221, 0.92);
  background: linear-gradient(135deg, #69afff 0%, #59c8cf 100%);
  color: #ffffff;
}

body.chat-page:not(.archive-page) .composer-submit:hover:not(:disabled) {
  border-color: rgba(72, 158, 205, 0.95);
  background: linear-gradient(135deg, #5ba4f7 0%, #4fbec5 100%);
  color: #ffffff;
}

html:not([data-theme="dark"]) body.admin-page .button:not(.button-secondary):not(.button-danger):not(.chat-message__delete-button):not(.chat-message__ban-button) {
  border-color: rgba(91, 177, 221, 0.92);
  background: linear-gradient(135deg, #69afff 0%, #59c8cf 100%);
  color: #ffffff;
}

html:not([data-theme="dark"]) body.admin-page .button:not(.button-secondary):not(.button-danger):not(.chat-message__delete-button):not(.chat-message__ban-button):hover {
  border-color: rgba(72, 158, 205, 0.95);
  background: linear-gradient(135deg, #5ba4f7 0%, #4fbec5 100%);
  color: #ffffff;
}

body.chat-page:not(.archive-page) .composer-side {
  border-left-color: rgba(140, 191, 235, 0.72);
}

body.chat-page:not(.archive-page) .chat-composer {
  border-top-color: rgba(140, 191, 235, 0.72);
}

body.chat-page:not(.archive-page) .chat-date-divider__line,
body.archive-page .chat-date-divider__line {
  background: rgba(140, 191, 235, 0.72);
}

html[data-theme="dark"] body.chat-page:not(.archive-page) .button:not(.composer-submit),
html[data-theme="dark"] body.chat-page:not(.archive-page) .button-secondary:not(.composer-submit),
html[data-theme="dark"] body.login-page .button-secondary,
html[data-theme="dark"] body.admin-page .button-secondary,
html[data-theme="dark"] body.archive-page .button:not(.composer-submit),
html[data-theme="dark"] body.archive-page .button-secondary:not(.composer-submit) {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: #f5f5f5;
}

html[data-theme="dark"] body.chat-page:not(.archive-page) .button:not(.composer-submit):hover,
html[data-theme="dark"] body.chat-page:not(.archive-page) .button-secondary:not(.composer-submit):hover,
html[data-theme="dark"] body.login-page .button-secondary:hover,
html[data-theme="dark"] body.admin-page .button-secondary:hover,
html[data-theme="dark"] body.archive-page .button:not(.composer-submit):hover,
html[data-theme="dark"] body.archive-page .button-secondary:not(.composer-submit):hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

html[data-theme="dark"] body.chat-page:not(.archive-page) .composer-submit {
  border-color: rgba(255, 255, 255, 0.38);
  background: linear-gradient(180deg, #ffffff 0%, #d7d7d7 100%);
  color: #050505;
}

html[data-theme="dark"] body.chat-page:not(.archive-page) .composer-submit:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.48);
  background: linear-gradient(180deg, #f7f7f7 0%, #c9c9c9 100%);
  color: #050505;
}

html[data-theme="dark"] body.admin-page .button:not(.button-secondary):not(.button-danger):not(.chat-message__delete-button):not(.chat-message__ban-button) {
  border-color: rgba(255, 255, 255, 0.38);
  background: linear-gradient(180deg, #ffffff 0%, #d7d7d7 100%);
  color: #050505;
}

html[data-theme="dark"] body.admin-page .button:not(.button-secondary):not(.button-danger):not(.chat-message__delete-button):not(.chat-message__ban-button):hover {
  border-color: rgba(255, 255, 255, 0.48);
  background: linear-gradient(180deg, #f7f7f7 0%, #c9c9c9 100%);
  color: #050505;
}

html[data-theme="dark"] body.chat-page:not(.archive-page) .composer-side,
html[data-theme="dark"] body.chat-page:not(.archive-page) .chat-composer {
  border-color: rgba(255, 255, 255, 0.16);
}

html[data-theme="dark"] body.chat-page:not(.archive-page) .chat-date-divider__line,
html[data-theme="dark"] body.archive-page .chat-date-divider__line {
  background: rgba(255, 255, 255, 0.16);
}

html[data-theme="dark"] .chat-bbcode-quote {
  background: rgba(255, 255, 255, 0.04);
}

html[data-theme="dark"] .chat-bbcode-quote__label {
  color: #cfcfcf;
}

html[data-theme="dark"] .chat-avatar {
  border-width: 0;
  border-color: transparent;
}

html[data-theme="dark"] .chat-avatar--default {
  --avatar-bg: var(--avatar-bg-dark, var(--avatar-bg-light, var(--panel)));
  --avatar-border: var(--avatar-border-dark, var(--avatar-border-light, var(--border)));
  --avatar-fill: var(--avatar-fill-dark, var(--avatar-fill-light, var(--muted)));
}

html[data-theme="dark"] .chat-bbcode-spoiler {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
}

html[data-theme="dark"] .chat-bbcode-spoiler summary {
  color: #f1f1f1;
  background: rgba(255, 255, 255, 0.03);
}

html[data-theme="dark"] .chat-bbcode-spoiler[open] summary {
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] .chat-bbcode-spoiler__content {
  background: rgba(255, 255, 255, 0.02);
}

.login-page .topbar {
  align-items: center;
  margin-bottom: 12px;
}

.login-page .title-group {
  display: flex;
  align-items: center;
  min-height: 34px;
}

.login-page .title-group .eyebrow {
  margin-bottom: 0;
}

.login-page .card-chat {
  padding: 28px;
}

.login-page .stack-form {
  gap: 18px;
}

.login-page .field input {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(138, 185, 235, 0.55);
}

.login-page .field span {
  color: #4f6787;
}

.login-page .field input:focus {
  border-color: rgba(113, 167, 229, 0.95);
}

.login-page .form-actions {
  justify-content: flex-end;
}

.login-page .form-actions .button {
  min-width: 124px;
  min-height: 46px;
  border-color: rgba(91, 177, 221, 0.92);
  background: linear-gradient(135deg, #69afff 0%, #59c8cf 100%);
  color: #ffffff;
}

.login-page .form-actions .button:hover {
  border-color: rgba(72, 158, 205, 0.95);
  background: linear-gradient(135deg, #5ba4f7 0%, #4fbec5 100%);
  color: #ffffff;
}

html[data-theme="dark"] .login-page .field input {
  background: rgba(18, 18, 18, 0.86);
  border-color: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] .login-page .field span {
  color: #cfd5de;
}

html[data-theme="dark"] .login-page .field input:focus {
  border-color: rgba(255, 255, 255, 0.24);
}

html[data-theme="dark"] .login-page .form-actions .button {
  border-color: rgba(255, 255, 255, 0.38);
  background: linear-gradient(180deg, #ffffff 0%, #d7d7d7 100%);
  color: #050505;
}

html[data-theme="dark"] .login-page .form-actions .button:hover {
  border-color: rgba(255, 255, 255, 0.48);
  background: linear-gradient(180deg, #f7f7f7 0%, #c9c9c9 100%);
  color: #050505;
}

.delete-confirm-copy {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-muted);
  padding: 12px 14px;
  color: var(--text);
  line-height: 1.6;
}

.stack-form,
.toolbar-form {
  display: grid;
  gap: 16px;
}

.admin-function-form {
  align-content: start;
}

.regulate-panel {
  align-content: start;
}

.regulate-form {
  gap: 14px;
}

.admin-panel-regulate .regulate-form {
  margin-block: 14px 16px;
}

.admin-panel-moderate .regulate-form {
  margin-block: 14px 16px;
}

.regulate-form__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 112px;
  gap: 16px;
  align-items: start;
}

.moderate-form__row {
  display: grid;
  gap: 16px;
  align-items: start;
}

.moderate-form__row--ban {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 112px;
}

.moderate-form__row--timeout {
  grid-template-columns: minmax(0, 1fr) 112px;
}

.regulate-form__action {
  display: grid;
  grid-template-rows: 22px 56px;
  gap: 8px;
  align-items: stretch;
}

.regulate-form__toggles {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.regulate-form__action-label {
  display: block;
  visibility: hidden;
  min-height: 22px;
}

.admin-page .regulate-form__add-button.button {
  width: 100%;
  align-self: center;
  height: auto;
  justify-content: center;
}

.regulate-form__actions {
  justify-content: flex-start;
  margin-top: 2px;
  margin-bottom: 12px;
}

.regulate-list {
  display: grid;
  gap: 12px;
}

.regulate-list-scrollable {
  max-height: 376px;
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-gutter: stable;
}

.regulate-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-muted);
  overflow: hidden;
}

.regulate-table thead th {
  background: var(--panel);
  padding: 14px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}

.regulate-table th,
.regulate-table td {
  vertical-align: middle;
}

.regulate-table th + th,
.regulate-table td + td {
  border-left: 1px solid var(--border);
}

.regulate-table tbody tr + tr td {
  border-top: 1px solid var(--border);
}

.regulate-table tbody td {
  padding: 14px 16px;
  overflow-wrap: anywhere;
  text-align: center;
}

.regulate-table--compact {
  table-layout: fixed;
}

.regulate-table__actions-column,
.regulate-table__actions-cell {
  width: 168px;
  text-align: center;
  white-space: nowrap;
}

.regulate-table__actions-cell form {
  display: inline-flex;
}

.regulate-table__action-group {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.regulate-table__action-group form {
  display: inline-flex;
}

.regulate-table__ip-header,
.regulate-table__ip-cell {
  white-space: nowrap;
}

.regulate-table__ip-text {
  display: inline-block;
  max-width: 100%;
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 0.92rem;
  white-space: nowrap;
}

.regulate-table__reason-cell {
  white-space: normal;
  line-height: 1.55;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.regulate-table__detail {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.85rem;
}

.regulate-table__muted {
  color: var(--muted);
}

.regulate-toggle {
  margin-top: 2px;
}

.regulate-form__scope-field {
  max-width: 320px;
}

.admin-function-form__actions {
  justify-content: flex-end;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.modal[hidden] {
  display: none;
}

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

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 16, 22, 0.55);
}

.modal__dialog {
  position: relative;
  width: min(520px, 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 22px;
  overflow: visible;
}

.modal__dialog-delete {
  width: min(620px, 100%);
}

.modal__dialog-bbcode {
  width: min(720px, 100%);
  max-height: min(80vh, 760px);
  overflow: auto;
}

.modal__header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.modal__title-group h2 {
  margin: 0;
  font-size: 1.35rem;
}

.modal__form {
  padding-inline: 6px;
}

.modal__actions {
  justify-content: center;
  margin-top: 18px;
  padding-block: 0;
}

#settings-modal .modal__actions {
  margin-top: 0;
  padding-block: 15px;
}

.admin-page #settings-modal .modal__dialog {
  background: var(--chat-glass-panel-strong);
  border-color: var(--chat-glass-border);
  backdrop-filter: blur(24px) saturate(155%);
  -webkit-backdrop-filter: blur(24px) saturate(155%);
}

html:not([data-theme="dark"]) .admin-page #settings-modal .button-secondary {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(138, 185, 235, 0.78);
  color: #4f7fbe;
}

html:not([data-theme="dark"]) .admin-page #settings-modal .button-secondary:hover {
  background: rgba(240, 248, 255, 0.98);
  border-color: rgba(113, 167, 229, 0.9);
  color: #3f6fae;
}

html[data-theme="dark"] .admin-page #settings-modal .button-secondary {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: #f5f5f5;
}

html[data-theme="dark"] .admin-page #settings-modal .button-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.delete-preview-list {
  display: grid;
  gap: 10px;
  max-height: 280px;
  overflow: auto;
}

.delete-preview-list[hidden] {
  display: none !important;
}

.delete-preview-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-muted);
  padding: 12px 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

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

.bbcode-help-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-muted);
  padding: 12px 14px;
  user-select: text;
}

.bbcode-help-item code {
  display: block;
  margin: 0 0 6px;
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
}

.bbcode-help-item p {
  margin: 0;
  color: var(--muted);
  user-select: text;
}

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

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 0.92rem;
  font-weight: 600;
}

html:not([data-theme="dark"]) body.chat-page #settings-modal .field span {
  color: #4f6787;
}

html:not([data-theme="dark"]) body.admin-page .field span,
html:not([data-theme="dark"]) body.admin-page .admin-toggle span,
html:not([data-theme="dark"]) body.admin-page #settings-modal .field span {
  color: #4f6787;
}

html[data-theme="dark"] body.admin-page .field span,
html[data-theme="dark"] body.admin-page .admin-toggle span,
html[data-theme="dark"] body.admin-page #settings-modal .field span {
  color: #cfd5de;
}

.admin-toggle-list {
  display: grid;
  gap: 12px;
}

.admin-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-toggle[hidden] {
  display: none !important;
}

.field[hidden],
.form-actions[hidden] {
  display: none !important;
}

.admin-toggle input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

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

.form-grid[hidden] {
  display: none !important;
}

.form-grid--three-up {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-settings-subsection {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.admin-settings-subtitle {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.field-full {
  grid-column: 1 / -1;
}

.section-block + .section-block {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.pagination {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.title-link {
  display: inline-block;
  text-decoration: none;
}

.title-link:hover {
  opacity: 0.88;
}

.pagination__row {
  width: min(100%, 760px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: 18px;
  padding-inline: 12px;
  box-sizing: border-box;
}

.pagination__controls {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.pagination__meta {
  grid-column: 3;
  justify-self: end;
  margin: 0;
  white-space: nowrap;
}

.pagination-admin .pagination__row {
  width: 100%;
  max-width: none;
}

.pagination-admin .pagination__meta {
  padding-right: 12px;
}

.pagination__pages {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pagination__page {
  min-width: 42px;
  justify-content: center;
}

.pagination__page.is-current {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

html:not([data-theme="dark"]) body.chat-page .button.pagination__page.is-current {
  border-color: rgba(91, 177, 221, 0.92);
  background: linear-gradient(135deg, #69afff 0%, #59c8cf 100%);
  color: #ffffff;
}

html:not([data-theme="dark"]) body.chat-page .button.pagination__page.is-current:hover {
  border-color: rgba(72, 158, 205, 0.95);
  background: linear-gradient(135deg, #5ba4f7 0%, #4fbec5 100%);
  color: #ffffff;
}

html[data-theme="dark"] body.chat-page .button.pagination__page.is-current {
  border-color: rgba(255, 255, 255, 0.38);
  background: linear-gradient(180deg, #ffffff 0%, #d7d7d7 100%);
  color: #050505;
}

html[data-theme="dark"] body.chat-page .button.pagination__page.is-current:hover {
  border-color: rgba(255, 255, 255, 0.48);
  background: linear-gradient(180deg, #f7f7f7 0%, #c9c9c9 100%);
  color: #050505;
}

html:not([data-theme="dark"]) body.admin-page .button.pagination__page.is-current {
  border-color: rgba(91, 177, 221, 0.92);
  background: linear-gradient(135deg, #69afff 0%, #59c8cf 100%);
  color: #ffffff;
}

html:not([data-theme="dark"]) body.admin-page .button.pagination__page.is-current:hover {
  border-color: rgba(72, 158, 205, 0.95);
  background: linear-gradient(135deg, #5ba4f7 0%, #4fbec5 100%);
  color: #ffffff;
}

html[data-theme="dark"] body.admin-page .button.pagination__page.is-current {
  border-color: rgba(255, 255, 255, 0.38);
  background: linear-gradient(180deg, #ffffff 0%, #d7d7d7 100%);
  color: #050505;
}

html[data-theme="dark"] body.admin-page .button.pagination__page.is-current:hover {
  border-color: rgba(255, 255, 255, 0.48);
  background: linear-gradient(180deg, #f7f7f7 0%, #c9c9c9 100%);
  color: #050505;
}

.pagination__ellipsis {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1;
}

.message-detail {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}

.message-detail__label {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.meta-stack {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.mono {
  font-family: "Cascadia Code", "Consolas", monospace;
}

.ip-address {
  display: block;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.chat-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  overflow-wrap: anywhere;
}

.chat-link:hover {
  color: var(--accent-strong);
}

.notice {
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.notice-success {
  background: var(--success-bg);
  border-color: var(--success-border);
}

.notice-error {
  background: var(--error-bg);
  border-color: var(--error-border);
}

.error-list {
  margin: 10px 0 0;
  padding-left: 18px;
}

.empty-state {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  color: var(--muted);
  background: var(--panel-muted);
}

.empty-state-static {
  background: var(--panel);
}

.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;
}

@media (max-width: 860px) {
  .admin-settings-split,
  .admin-settings-split--triple {
    grid-template-columns: 1fr;
  }

  .admin-settings-split__divider {
    display: none;
  }

  .toolbar-grid,
  .form-grid,
  .regulate-form__row,
  .moderate-form__row {
    grid-template-columns: 1fr;
  }

  .admin-messages-controls__row {
    grid-template-columns: 1fr;
  }

  .admin-messages-controls__actions {
    align-items: stretch;
    justify-content: flex-start;
  }

  .field-full {
    grid-column: auto;
  }

  .regulate-form__action-label {
    display: none;
  }

  .regulate-form__action {
    grid-template-rows: auto;
  }

  .bbcode-picker {
    grid-template-columns: 1fr;
  }

  .bbcode-picker__actions {
    grid-auto-flow: column;
    justify-content: flex-start;
  }

  .avatar-upload-grid {
    grid-template-columns: 1fr;
  }

  .avatars-rotation-row {
    grid-template-columns: 1fr;
  }

  .avatars-settings-split {
    grid-template-columns: 1fr;
  }

  .avatars-settings-split__divider {
    display: none;
  }

  .avatar-upload-grid__divider {
    display: none;
  }

  .avatar-cropper {
    width: 100%;
  }

  .avatar-cropper__stage {
    width: min(100%, var(--avatar-upload-preview-size));
    justify-self: start;
  }

  .avatar-cropper__controls,
  .avatar-cropper__zoom {
    width: min(100%, var(--avatar-upload-preview-size));
  }

  .regulate-table,
  .regulate-table thead,
  .regulate-table tbody,
  .regulate-table tr,
  .regulate-table th,
  .regulate-table td {
    display: block;
    width: 100%;
  }

  .regulate-table thead {
    display: none;
  }

  .regulate-table tbody tr + tr td {
    border-top: 0;
  }

  .regulate-table tbody tr + tr {
    border-top: 1px solid var(--border);
  }

  .regulate-table th + th,
  .regulate-table td + td {
    border-left: 0;
  }

  .regulate-table tbody td + td {
    border-top: 1px solid var(--border);
  }

  .regulate-table__actions-column,
  .regulate-table__actions-cell {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 15px 14px;
  }

  .chat-page:not(.archive-page) .page-shell {
    padding: 15px 12px;
  }

  .archive-page .page-shell {
    padding: 15px 12px;
  }

  .chat-page:not(.archive-page) .page-width {
    height: calc(100dvh - 30px);
    min-height: calc(100dvh - 30px);
  }

  .archive-page .page-width {
    height: calc(100dvh - 30px);
    min-height: calc(100dvh - 30px);
  }

  .topbar,
  .admin-toolbar,
  .card-heading,
  .chat-message__meta,
  .composer-actions,
  .composer-footer,
  .form-actions,
  .inline-actions,
  .message-actions {
    flex-direction: column;
    align-items: stretch;
  }

  body.chat-page .topbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
  }

  body.chat-page .topbar .title-group {
    display: flex;
    align-items: center;
    min-width: 0;
  }

  body.chat-page .topbar-menu-toggle {
    display: inline-flex;
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
    margin-left: auto;
    flex: 0 0 auto;
  }

  body.chat-page .topbar .topbar-actions {
    display: none;
  }

  body.chat-page .topbar .eyebrow {
    font-size: 0.74rem;
    letter-spacing: 0.14em;
  }

  body.chat-page .topbar-menu-toggle__icon,
  body.chat-page .topbar-menu-toggle__icon::before,
  body.chat-page .topbar-menu-toggle__icon::after {
    width: 16px;
  }

  body.chat-page .topbar-menu-toggle__icon::before {
    top: -5px;
  }

  body.chat-page .topbar-menu-toggle__icon::after {
    top: 5px;
  }

  .chat-feed {
    gap: 10px;
    min-height: 300px;
    max-height: min(650px, calc(100vh - 260px));
    padding: 4px 8px 4px 0;
  }

  .chat-page .chat-feed .chat-message {
    grid-template-columns: 40px 1px minmax(0, 1fr);
    column-gap: 14px;
    padding: 12px 14px;
    border-radius: 12px;
  }

  .chat-page .chat-message__divider {
    width: 1px;
    min-height: 100%;
    align-self: stretch;
    background: rgba(162, 205, 240, 0.82);
  }

  .admin-feed .chat-message {
    grid-template-columns: 44px 1px minmax(0, 1fr) 1px auto;
    column-gap: 14px;
  }

  .chat-page .card-chat {
    padding: 14px;
    border-radius: 16px;
  }

  .chat-avatar {
    width: 40px;
    min-width: 40px;
    height: 40px;
  }

  .chat-avatar__head {
    top: 8px;
    width: 11px;
    height: 11px;
  }

  .chat-avatar__body {
    bottom: 8px;
    width: 20px;
    height: 11px;
  }

  .chat-message__content {
    align-content: start;
  }

  .chat-message__body {
    font-size: 0.96rem;
    line-height: 1.45;
  }

  .chat-date-divider {
    margin: 2px 0;
  }

  .chat-composer {
    margin-top: 14px;
    padding-top: 14px;
    gap: 8px;
  }

  .composer-editor {
    min-height: 116px;
  }

  .composer-editor textarea,
  .composer-highlight {
    min-height: 116px;
    font-size: 0.95rem;
    line-height: 1.4;
  }

  .composer-highlight {
    padding: 12px 14px 58px 42px;
  }

  .composer-editor textarea {
    min-height: 116px;
    padding: 12px 14px 58px 42px;
  }

  .chat-page .composer-editor .composer-help-button.button {
    top: 10px;
    left: 10px;
    width: 22px;
    min-width: 22px;
    height: 22px;
    min-height: 22px;
    font-size: 0.85rem;
  }

  .composer-side {
    top: auto;
    right: 12px;
    left: 12px;
    bottom: 10px;
    width: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding-top: 8px;
    padding-left: 0;
    padding-right: 0;
    border-left: 0;
    border-top: 1px solid rgba(162, 205, 240, 0.82);
  }

  .composer-editor .character-counter {
    width: auto;
    flex: 0 0 auto;
    margin-right: 0;
    font-size: 0.84rem;
    text-align: left;
  }

  .chat-page .composer-side .composer-submit {
    width: 96px;
    min-width: 96px;
    min-height: 40px;
    height: 40px;
    border-radius: 12px;
    justify-self: auto;
    flex: 0 0 auto;
  }

  .site-menu__panel {
    width: min(320px, 86vw);
    padding: 22px 18px;
  }

  .site-menu__actions {
    gap: 10px;
  }

  .pagination__row {
    grid-template-columns: 1fr;
    row-gap: 10px;
    justify-items: center;
  }

  .pagination__controls,
  .pagination__meta {
    grid-column: auto;
    justify-self: center;
  }

  .button,
  .button-secondary,
  .button-danger {
    width: 100%;
  }

  .topbar-menu-toggle,
  .topbar-menu-toggle.button,
  .topbar-menu-toggle.button-secondary {
    width: 38px;
    min-width: 38px;
  }

  .chat-message__actions .button,
  .chat-message__actions .button-danger {
    width: auto;
  }

    .admin-toolbar-actions {
      margin-left: 0;
    }

    .admin-settings-split {
      grid-template-columns: 1fr;
    }

    .admin-settings-split__divider {
      width: 100%;
      height: 1px;
    }

    .composer-submit {
      width: auto;
  }

  .modal__actions {
    flex-direction: row;
    align-items: center;
  }

  .modal__actions .button,
  .modal__actions .button-secondary,
  .modal__actions .button-danger {
    width: auto;
  }
}

@media (min-width: 721px) {
  body.chat-page .topbar-menu-toggle,
  body.chat-page .site-menu {
    display: none !important;
  }
}
