/* ==========================================================================
   Warden Chat - dark, professional, privacy-first UI
   ========================================================================== */

/* Only major surfaces transition; do not animate every row in long histories. */
.theme-changing body, .theme-changing .sidebar, .theme-changing .chat-pane,
.theme-changing .chat-head, .theme-changing .composer, .theme-changing .modal, .theme-changing .message-search,
.theme-changing .input, .theme-changing .auth-card, .theme-changing .settings-heading {
  transition: background-color var(--motion-normal) var(--motion-ease-out),
    color var(--motion-normal) var(--motion-ease-out), border-color var(--motion-normal) var(--motion-ease-out);
}
:root[data-theme="light"] .form-error,
:root[data-theme="light"] .composer-error,
:root[data-theme="light"] .toast.is-error { color: var(--danger); }
:root[data-theme="light"] .site-admin-badge { color: #174dad; }
:root[data-theme="light"] .char-count.is-near { color: #875800; }

*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

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

svg { width: 1em; height: 1em; fill: currentColor; display: block; }
.ui-icon { display: inline-block; width: var(--icon-size); height: var(--icon-size); flex: none; background: currentColor; mask: var(--glyph) center / contain no-repeat; }
.icon-reply { --glyph: url('/img/icons/reply.svg'); }
.icon-copy { --glyph: url('/img/icons/copy.svg'); }
.icon-link { --glyph: url('/img/icons/link.svg'); }
.icon-add { --glyph: url('/img/icons/add.svg'); }
.icon-close { --glyph: url('/img/icons/close.svg'); }
.icon-edit { --glyph: url('/img/icons/edit.svg'); }
.icon-delete { --glyph: url('/img/icons/delete.svg'); }
.icon-block { --glyph: url('/img/icons/block.svg'); }
.icon-verified { --glyph: url('/img/icons/verified.svg'); }
.icon-group { --glyph: url('/img/icons/group.svg'); }
.icon-search { --glyph: url('/img/icons/search.svg'); }
.icon-pin { --glyph: url('/img/icons/pin.svg'); }
.icon-muted { --glyph: url('/img/icons/muted.svg'); }
.icon-unmuted { --glyph: url('/img/icons/unmuted.svg'); }
.icon-settings { --glyph: url('/img/icons/settings.svg'); }
.icon-info { --glyph: url('/img/icons/info.svg'); }
.icon-attach { --glyph: url('/img/icons/attach.svg'); }
.icon-more { --glyph: url('/img/icons/more.svg'); }
.conversation-flags .ui-icon, .site-admin-badge .ui-icon { width: 14px; height: 14px; }
.bubble a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
.message.is-mine .bubble a { color: #fff; }

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

[hidden] { display: none !important; }

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

/* ============================ Buttons ============================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  min-height: var(--control-height);
  font-size: var(--type-body);
  font-weight: var(--weight-control);
  cursor: pointer;
  background: var(--panel-2);
  color: var(--text);
  transition: background .15s ease, border-color .15s ease, opacity .15s ease;
  white-space: nowrap;
}

.btn:hover:not(:disabled) { background: var(--panel-3); }
.btn:not(.btn-ghost):not(.btn-primary):not(.btn-danger):hover:not(:disabled) { background: var(--control-hover); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-dim);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--panel-2);
  color: var(--text);
}

.btn-danger {
  background: transparent;
  border-color: transparent;
  color: var(--danger);
}
.btn-danger:hover:not(:disabled) { background: rgba(229, 72, 77, .12); }

.btn-block { width: 100%; }
.btn-sm { padding: var(--space-1) var(--space-3); font-size: var(--type-body); }
.btn-icon { font-size: 16px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--control-height); height: var(--control-height);
  flex: none;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: var(--icon-size);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.icon-btn:hover:not(:disabled) { background: var(--panel-2); color: var(--text); }

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--text-muted);
  font-size: var(--type-body);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link-btn:hover { color: var(--text); }

/* ============================ Fields ============================ */

.field {
  display: block;
  margin-bottom: var(--space-4);
}

.field-label {
  display: block;
  font-size: var(--type-body);
  font-weight: var(--weight-control);
  color: var(--text-dim);
  margin-bottom: var(--space-2);
}

.field-hint {
  display: block;
  font-size: var(--type-meta);
  color: var(--text-muted);
  margin-top: var(--space-2);
}

.input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  min-height: var(--control-height);
  color: var(--text);
  transition: border-color .15s ease, background .15s ease;
}
.input::placeholder { color: var(--text-muted); }
.input:focus {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
  border-color: transparent;
}

.form-error {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(229, 72, 77, .1);
  border: 1px solid var(--danger-dim);
  color: #ff9a9d;
  font-size: 13px;
}

.form-ok {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid transparent;
  color: var(--text-primary);
  font-size: var(--type-body);
}
.form-ok::before { content: '\2713'; margin-inline-end: var(--space-2); }

/* ============================ Avatars ============================ */

.avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-3);
  color: var(--text);
  font-weight: var(--weight-heading);
  text-transform: uppercase;
  user-select: none;
}

.avatar::after {
  content: attr(data-initial);
  line-height: 1;
}

.avatar > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-sm { width: 32px; height: 32px; font-size: 13px; }
.avatar-md { width: 40px; height: 40px; font-size: 15px; }
.avatar-lg { width: 72px; height: 72px; font-size: 26px; }

.avatar.is-group { border-radius: var(--radius-control); background: var(--surface-2); color: var(--text-secondary); }
.avatar.is-group::after { content: ''; width: 55%; height: 55%; background: currentColor; mask: url('/img/icons/group.svg') center / contain no-repeat; }
.modal .avatar:not(.is-group) { background: var(--surface-2); }
.avatar > img { z-index: 1; }

.presence-dot {
  width: 7px; height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--text-muted);
  box-shadow: 0 0 0 2px var(--panel);
}
.presence-dot.is-online { background: var(--online); }

/* ============================ Auth screen ============================ */

.auth-screen {
  display: flex;
  align-items: safe center;
  justify-content: center;
  height: var(--app-height, 100dvh);
  min-height: 0;
  padding: var(--space-6);
  overflow-y: auto;
  background: var(--surface-0);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 0;
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: none;
}

.auth-head { text-align: center; margin-bottom: 24px; }

.auth-logo {
  width: 72px; height: 72px;
  border-radius: 50%;
  border: 1px solid var(--border);
  object-fit: contain;
  flex-shrink: 0;
}

.auth-wordmark {
  margin: 14px 0 4px;
  font-size: var(--type-title);
  font-weight: var(--weight-heading);
  letter-spacing: -.02em;
}

.auth-tagline {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--bg-elevated);
  border: 0;
  border-radius: var(--radius-sm);
  margin-bottom: 22px;
}

.tab {
  border: 0;
  border-radius: 6px;
  padding: 9px;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: var(--weight-control);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--panel-3); color: var(--text); }

.auth-form .btn-block { margin-top: 4px; }

.auth-privacy {
  margin: 22px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--border-soft);
  font-size: var(--type-body);
  line-height: 1.6;
  color: var(--text-muted);
  text-align: left;
}

/* ============================ App shell ============================ */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  position: fixed;
  inset-inline: 0;
  top: var(--viewport-top, 0px);
  height: var(--app-height, 100dvh);
  min-height: 0;
  min-width: 0;
}

/* ============================ Sidebar ============================ */

.sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--panel);
  border-right: 1px solid var(--border);
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
}

.brand-mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  object-fit: contain;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.brand-name {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: var(--weight-heading);
  letter-spacing: -.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-profile-text { display: block; color: var(--text-muted); font-size: var(--type-body); font-weight: var(--weight-normal, 400); white-space: pre-wrap; overflow-wrap: anywhere; unicode-bidi: plaintext; }

.me-chip {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4) var(--space-1);
  border-top: 1px solid var(--border-soft);
}

.me-name {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.start-chat { padding: 0 var(--space-4) var(--space-3); }

.start-chat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.start-chat-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.start-chat-input {
  padding-left: 34px;
  font-size: 14px;
}

.start-chat-go { flex: none; }

.start-chat-error { margin: 10px 0 0; }

.sidebar-actions { display: flex; gap: var(--space-1); padding: var(--space-2) var(--space-3); }
.sidebar-actions .btn { flex: 1; padding-inline: var(--space-2); }
.conversation-filter { display: flex; align-items: center; gap: var(--space-2); margin: 0 var(--space-4); padding: 0 var(--space-3); border-radius: var(--radius-control); background: var(--surface-2); color: var(--text-muted); }
.conversation-filter .input { border: 0; background: transparent; padding-inline: 0; font-size: var(--type-body); }
.conversation-filter:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.conversation-filter .input:focus { outline: none; }
.conversation-section { margin: var(--space-3) var(--space-2) var(--space-1); font-size: var(--type-meta); color: var(--text-muted); font-weight: var(--weight-control); }
/* An unread Admin message holds the top of the list until it is opened. The
   marker is a quiet edge rather than a second badge: the unread count is
   already there, and the section heading already says why the row is here. */
.conversation-section[data-section='From Warden Admin'] { color: var(--accent); }
.conv-item.is-admin-unread { box-shadow: inset 2px 0 0 var(--accent); }

.conversation-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 var(--space-2) var(--space-3);
}

.empty-note {
  margin: 24px 12px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
  text-align: center;
}

.conv-item {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  grid-template-rows: auto auto;
  column-gap: var(--space-3);
  align-items: center;
  width: 100%;
  border: 0;
  border-radius: var(--radius-small);
  padding: var(--space-2);
  margin-bottom: 2px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background .12s ease;
}
.conv-item:hover { background: var(--panel-2); }
.conv-item.is-active { background: var(--panel-2); }

.conv-avatar-wrap {
  grid-row: 1 / span 2;
  position: relative;
}

.conv-avatar-wrap .presence-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  box-shadow: 0 0 0 2px var(--panel);
}
.conv-item.is-active .conv-avatar-wrap .presence-dot { box-shadow: 0 0 0 2px var(--panel-3); }
.conv-avatar-wrap .presence-dot.typing-presence {
  width: 18px; height: 9px; display: inline-flex; align-items: center; justify-content: center; gap: 2px;
  border-radius: 6px; background: var(--panel-2); box-shadow: 0 0 0 2px var(--panel);
}
.conv-item.is-active .conv-avatar-wrap .presence-dot.typing-presence { box-shadow: 0 0 0 2px var(--panel-3); }
.typing-presence i { width: 3px; height: 3px; border-radius: 50%; background: var(--online); animation: typing-dot .9s ease-in-out infinite; }
.typing-presence i:nth-child(2) { animation-delay: .12s; }
.typing-presence i:nth-child(3) { animation-delay: .24s; }

.conv-title {
  grid-column: 2;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-time {
  grid-column: 3;
  grid-row: 1;
  font-size: var(--type-meta);
  color: var(--text-muted);
  white-space: nowrap;
}

.conv-preview {
  grid-column: 2;
  grid-row: 2;
  font-size: 13px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-badge {
  grid-column: 3;
  grid-row: 2;
  justify-self: end;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.sidebar-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 16px;
  padding-top: var(--space-1);
}

.conn-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.conn-state::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
}
.conn-state[data-state="live"]::before { background: var(--online); }
.conn-state[data-state="offline"]::before { background: var(--danger); }

/* ============================ Chat pane ============================ */

.chat-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}

.chat-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
}

.placeholder-logo {
  width: 96px; height: 96px;
  opacity: .55;
  margin-bottom: 10px;
  object-fit: contain;
  flex-shrink: 0;
}

.sanction-notice { width: min(440px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: var(--radius-lg); background: var(--surface-3); color: var(--text-primary); box-shadow: var(--shadow-lg); }
.sanction-notice::backdrop { background: rgba(5, 8, 12, .82); }
.sanction-notice-card { display: grid; justify-items: center; gap: var(--space-4); padding: clamp(1.5rem, 5vw, 2.5rem); text-align: center; }
.sanction-notice-card img { width: 56px; height: 56px; object-fit: contain; border-radius: 12px; border: 1px solid var(--border); }
.sanction-notice-card h2 { margin: 0; font-size: var(--type-title); }
.sanction-notice-card p { margin: 0; color: var(--text-secondary); line-height: 1.55; }
.sanction-notice-card .btn { min-width: 140px; margin-top: var(--space-2); }

.chat-placeholder h2 {
  margin: 0;
  font-size: 18px;
  color: var(--text-dim);
}
.chat-placeholder p { margin: 0; font-size: 14px; }

.chat-active {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  position: relative;
}

.chat-head, .typing-line, .composer,
.sidebar-head, .me-chip, .start-chat, .sidebar-actions, .sidebar-foot { flex-shrink: 0; }

.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--panel);
}

.back-btn { display: none; }

.chat-head-text { flex: 1; min-width: 0; }

.chat-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-subtitle {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-subtitle.is-online { color: var(--online); }

/* ---------------------------- Messages ---------------------------- */

.message-scroll, .conversation-list, .composer, .modal, .auth-screen, .member-list {
  scrollbar-width: thin;
  scrollbar-color: rgba(163, 173, 187, .4) transparent;
}
.message-scroll::-webkit-scrollbar,
.auth-screen::-webkit-scrollbar,
.member-list::-webkit-scrollbar,
.modal::-webkit-scrollbar,
.conversation-list::-webkit-scrollbar,
.composer::-webkit-scrollbar { width: 8px; }
.message-scroll::-webkit-scrollbar-track,
.auth-screen::-webkit-scrollbar-track,
.member-list::-webkit-scrollbar-track,
.modal::-webkit-scrollbar-track,
.conversation-list::-webkit-scrollbar-track,
.composer::-webkit-scrollbar-track { background: transparent; }
.message-scroll::-webkit-scrollbar-thumb,
.auth-screen::-webkit-scrollbar-thumb,
.member-list::-webkit-scrollbar-thumb,
.modal::-webkit-scrollbar-thumb,
.conversation-list::-webkit-scrollbar-thumb,
.composer::-webkit-scrollbar-thumb {
  background: rgba(163, 173, 187, .4);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.message-scroll::-webkit-scrollbar-thumb:hover, .conversation-list::-webkit-scrollbar-thumb:hover, .modal::-webkit-scrollbar-thumb:hover { background-color: var(--text-muted); }
.message-scroll::-webkit-scrollbar-button,
.modal::-webkit-scrollbar-button,
.conversation-list::-webkit-scrollbar-button,
.composer::-webkit-scrollbar-button { display: none; width: 0; height: 0; }

.message-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overflow-anchor: none; /* The message anchor below is preserved explicitly. */
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  padding: 18px 16px 6px;
}

.history-pane { display: flex; flex: 1; min-height: 0; min-width: 0; position: relative; }
.message-search { flex: none; min-width: 0; padding: 4px 12px; background: var(--surface-1); border-bottom: 1px solid var(--separator-soft); }
.message-search-row, .message-search-meta { display: flex; align-items: center; gap: var(--space-1); min-width: 0; }
.message-search-row .input { flex: 1; min-width: 0; }
#message-search-input::-webkit-search-cancel-button { display: none; }
.message-search-meta { font-size: var(--type-meta); color: var(--text-secondary); }
.message-search-meta [role="status"] { flex: 1; min-width: 0; }
.message-search-meta button { min-height: var(--touch-target); }
.message-search-meta .link-btn { min-width: var(--touch-target); }
.search-match { color: var(--search-match-text); background: var(--search-match-bg); padding: 0; border-radius: 2px; font: inherit; }
.search-match.is-active { outline: 2px solid var(--search-match-active); outline-offset: -1px; }
.jump-latest { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); z-index: 1; box-shadow: var(--shadow-sm); }
.unread-divider { list-style: none; text-align: center; color: var(--accent-hi); padding: 8px; font-size: 13px; }

.load-more-wrap { text-align: center; margin-bottom: 12px; }

.message-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.day-divider {
  align-self: center;
  margin: 16px 0 10px;
  padding: 4px 12px;
  border-radius: 999px;
  background: transparent;
  font-size: var(--type-meta);
  font-weight: var(--weight-control);
  color: var(--text-muted);
}

.system-message {
  align-self: center;
  margin: 8px 0;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  max-width: 80%;
}

.message {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  max-width: min(680px, 88%);
  margin-top: 10px;
}

.message.is-continuation { margin-top: 2px; }

.message.is-mine {
  grid-template-columns: minmax(0, 1fr);
  margin-left: auto;
  justify-items: end;
}

.message-column { min-width: 0; max-width: 100%; }

.message-avatar { grid-row: 1 / span 2; align-self: end; }
.message.is-continuation .message-avatar { visibility: hidden; }
.message.is-mine .message-avatar { display: none; }

.message-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 3px;
  font-size: 12px;
  color: var(--text-muted);
}
.message.is-continuation .message-meta { display: none; }

.message-author { font-weight: 600; color: var(--text-dim); }

.bubble-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}
.message.is-mine .bubble-row { flex-direction: row-reverse; }

.bubble {
  position: relative;
  min-width: 0;
  padding: 9px 13px;
  border-radius: var(--radius-bubble);
  background: var(--panel-2);
  border: 1px solid transparent;
  border-bottom-left-radius: 5px;
  font-size: var(--type-message);
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message.is-mine .bubble {
  background: var(--outgoing);
  border-color: transparent;
  color: var(--accent-ink);
  border-bottom-left-radius: var(--radius-bubble);
  border-bottom-right-radius: 5px;
}

.bubble.is-deleted {
  background: transparent;
  border-style: dashed;
  border-color: var(--border);
  color: var(--text-muted);
  font-style: italic;
}

.bubble.has-image { padding: 5px; }

.bubble-image {
  display: block;
  max-width: min(320px, 100%);
  max-height: 340px;
  width: auto;
  height: auto;
  border-radius: 11px;
  cursor: zoom-in;
  background: var(--bg-elevated);
}

/* Same envelope as an image, so a mixed history keeps one rhythm. */
.bubble-video {
  display: block;
  max-width: min(320px, 100%);
  max-height: 340px;
  width: auto;
  height: auto;
  border-radius: 11px;
  background: #000;
}

.bubble-file {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(320px, 100%);
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--bg-elevated);
  color: inherit;
  text-decoration: none;
}
.bubble-file:hover { background: var(--control-hover); }
.bubble-file[aria-disabled='true'] { opacity: .6; pointer-events: none; }
.bubble-file-icon {
  flex: 0 0 auto;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 10px;
  font-weight: var(--weight-control);
  letter-spacing: .04em;
}
.bubble-file-name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bubble-file-size { flex: 0 0 auto; font-size: 11px; color: var(--text-dim); }

/* An attachment past its thirty-day retention reads as the plain sentence it
   has become, not as a broken image. */
.bubble.is-expired .message-text { font-style: italic; color: var(--text-dim); }

.bubble-caption {
  padding: 7px 8px 3px;
  font-size: 14px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.bubble a.link-preview, .message.is-mine .bubble a.link-preview {
  display: grid;
  gap: 2px;
  min-width: 0;
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  white-space: normal;
  overflow-wrap: anywhere;
}
.link-preview strong { font-size: var(--type-body); font-weight: var(--weight-control); }
.link-preview span { font-size: var(--type-meta); color: var(--text-dim); }
.bubble a.link-preview:hover { color: var(--text); text-decoration: underline; }
.link-preview:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.bubble-time {
  flex: none;
  font-size: 11px;
  color: var(--text-muted);
  padding-bottom: 3px;
  opacity: 0;
  transition: opacity .12s ease;
}
.message:hover .bubble-time, .message:focus-within .bubble-time { opacity: 1; }

.message-menu { flex: none; width: 30px; height: 30px; opacity: .6; }
.message-menu:hover, .message-menu:focus-visible { opacity: 1; }
.message-action-list { display: grid; gap: 0; }
.reaction-picker, .message-reactions { display: flex; flex-wrap: wrap; gap: 6px; }
.message-reactions:not(:empty) { margin-top: 5px; }
.reaction-chip { border: 1px solid var(--border); border-radius: 99px; padding: 3px 9px; background: var(--panel-2); color: var(--text); cursor: pointer; }
.reaction-chip[aria-pressed="true"] { border-color: var(--focus); background: var(--surface-3); }
.reply-quote { display: block; width: 100%; border: 0; border-left: 3px solid currentColor; border-radius: 5px; background: rgba(0,0,0,.16); color: inherit; text-align: left; padding: 6px 9px; margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; font: inherit; font-size: 13px; }
.reply-quote:disabled { opacity: .7; cursor: default; }
.reply-preview { display: flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-2) var(--space-2); color: var(--text-dim); font-size: var(--type-body); }
.reply-preview span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edited-label { font-size: 12px; color: var(--text-muted); }
.edit-input { resize: vertical; min-height: 100px; max-height: 40dvh; }
.message:focus { outline: 2px solid var(--accent-hi); outline-offset: 4px; }
.chat-title[role="button"], #chat-avatar[role="button"] { cursor: pointer; }
.member-pagination { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 14px; }
#ownership-help { font-size: 14px; color: var(--text-dim); }

.message-delete {
  flex: none;
  width: 26px; height: 26px;
  font-size: 14px;
  opacity: 0;
  transition: opacity .12s ease;
}
.message:hover .message-delete,
.message-delete:focus-visible { opacity: 1; }
.message-delete:hover { color: var(--danger); }

.read-receipt {
  margin-top: 3px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
}

.message.is-pending .bubble { opacity: .6; }
.message.is-failed .bubble {
  background: transparent;
  border: 1px solid var(--danger-dim);
  color: #ff9a9d;
}

/* ---------------------------- Typing ---------------------------- */

.typing-line {
  margin: 0;
  padding: 0 20px 2px;
  min-height: 20px;
  font-size: 12px;
  font-style: italic;
  color: var(--text-muted);
}

/* ---------------------------- Composer ---------------------------- */

.composer {
  padding: 10px max(16px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  max-height: 48%;
  min-width: 0;
  overflow-y: auto;
  border-top: 1px solid var(--border-soft);
  background: var(--surface-2);
}

.attachment-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

.attachment-thumb {
  width: 44px; height: 44px;
  border-radius: 6px;
  object-fit: cover;
  flex: none;
}

.attachment-name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Real transfer progress. Native <progress> keeps the indeterminate state and
   the assistive-technology semantics without a custom widget or a frame loop. */
.attachment-progress {
  flex: 0 0 96px;
  width: 96px;
  height: 4px;
  border: 0;
  border-radius: 2px;
  background: var(--border-soft);
  appearance: none;
}
.attachment-progress::-webkit-progress-bar {
  background: var(--border-soft);
  border-radius: 2px;
}
.attachment-progress::-webkit-progress-value {
  background: var(--accent);
  border-radius: 2px;
}
.attachment-progress::-moz-progress-bar { background: var(--accent); border-radius: 2px; }
.attachment-preview.is-uploading .attachment-name { color: var(--text); }

.composer-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.composer-attach { margin-bottom: 3px; }

.composer-input {
  flex: 1;
  min-width: 0;
  max-height: calc(var(--app-height, 100dvh) * .38);
  resize: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 11px 13px;
  line-height: 1.5;
  font-size: 16px; /* Avoid focus-triggered zoom on iOS. */
  overflow-y: hidden;
  scrollbar-width: none;
}
.composer-input.is-height-limited { overflow-y: auto; }
.composer-input::-webkit-scrollbar { display: none; width: 0; height: 0; }
.composer-input::placeholder { color: var(--text-muted); }
.composer-input:disabled { min-height: 84px; }
.composer-input:focus {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
  border-color: transparent;
}

.char-count {
  flex: none;
  align-self: flex-end;
  margin-bottom: 12px;
  font-size: var(--type-meta);
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}
.char-count.is-near { color: var(--text-primary); }
.char-count.is-over { color: var(--danger); font-weight: 600; }

/* Owner-approved Send contract: deliberately independent of new visual tokens.
   Only the explicitly approved confirmed-send feedback may change temporarily. */
#composer-send {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #2f6fed;
  color: #fff;
  font: 600 14px/21px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 0;
  flex: none;
  margin-bottom: 2px;
  padding: 11px 18px;
}
#composer-send:hover:not(:disabled) { background: #4785ff; }
#composer-send:focus-visible { outline-color: #4785ff; }
.composer-send svg { font-size: 16px; }
.send-flight { position: absolute; inset: 0; pointer-events: none; }
.send-flight-object { position: absolute; left: calc(50% - 8px); top: calc(50% - 8px); width: 16px; height: 16px; }
.send-flight-object svg { position: absolute; inset: 0; width: 16px; height: 16px; }
.send-flight-check { opacity: 0; }

.composer-error { margin: 10px 0 0; }

/* ============================ Modals ============================ */

.modal {
  width: min(460px, calc(100vw - 32px));
  max-height: min(86dvh, 760px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-3);
  color: var(--text);
  box-shadow: var(--shadow);
  overflow: auto;
}

.modal::backdrop {
  background: rgba(4, 6, 9, .72);
}

.modal-form { padding: var(--space-6); }

.modal-title {
  margin: 0 0 20px;
  font-size: var(--type-title);
  font-weight: var(--weight-heading);
}

.details-block {
  margin-block: 0 var(--space-6);
}
.details-block:last-of-type { border-bottom: 0; }

.details-heading {
  margin: 0 0 10px;
  font-size: var(--type-body);
  font-weight: var(--weight-heading);
  color: var(--text-primary);
}

.chip-input {
  display: flex;
  gap: 8px;
  align-items: center;
}
.chip-input .btn { flex: none; }

.chip-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 7px 5px 11px;
  border-radius: 999px;
  background: var(--panel-3);
  border: 1px solid var(--border);
  font-size: 13px;
}

.chip-remove {
  width: 18px; height: 18px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.chip-remove:hover { background: var(--danger); color: #fff; }

.member-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 260px;
  overflow-y: auto;
}

.member-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0;
  min-height: var(--touch-target);
  border-radius: var(--radius-sm);
}
.member-row:hover { background: var(--panel-2); }
.member-list .empty-note { margin: 0; text-align: left; font-size: var(--type-meta); }

.member-name {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-role {
  font-size: var(--type-meta);
  font-weight: var(--weight-body);
  color: var(--text-muted);
}

.avatar-block {
  display: flex;
  align-items: center;
  gap: 18px;
}

.avatar-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 6px;
}
.modal-actions .btn-danger { margin-right: auto; }

/* ============================ Lightbox ============================ */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: rgba(4, 6, 9, .93);
}

.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius);
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 42px; height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-close:hover { background: rgba(255, 255, 255, .2); }

/* ============================ Toasts ============================ */

.toast-host {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--panel-3);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  font-size: 13.5px;
  max-width: min(90vw, 460px);
  text-align: center;
}
.toast.is-error {
  background: rgba(229, 72, 77, .16);
  border-color: var(--danger-dim);
  color: #ffb2b4;
}

/* ============================ Responsive ============================ */

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }

  .sidebar,
  .chat-pane {
    grid-column: 1;
    grid-row: 1;
    min-height: 0;
  }

  .sidebar { border-right: 0; }

  /* One pane at a time on small screens. */
  .app[data-view="chat"] .sidebar { display: none; }
  .app[data-view="list"] .chat-pane { display: none; }

  .back-btn { display: inline-flex; }

  .message { max-width: 92%; }
  .bubble-image,
  .bubble-video,
  .bubble-file { max-width: min(74vw, 300px, 100%); }
  .bubble-time { opacity: 1; }
  .message-delete { opacity: 1; }

  #composer-send { padding: 11px 13px; }
  .composer-send-text { display: none; }

  .char-count { margin-bottom: 13px; }
}

@media (max-width: 420px) {
  .auth-card { padding: 24px 20px; }
  .modal-form { padding: 20px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
/* Server-verified identity is visually distinct from a group's Owner role. */
.site-admin-badge {
  display: inline-flex;
  align-items: center;
  margin-inline-start: .4rem;
  color: var(--focus);
  vertical-align: -.15em;
  white-space: nowrap;
}
.site-admin-badge[hidden] { display: none; }

/* Shared motion changes no layout dimensions or scroll-container geometry. */
.btn, .icon-btn, .input, .conv-item, .presence-dot, .chat-subtitle,
.reaction-chip, .bubble-time, .message-menu {
  transition: background-color var(--motion-normal) var(--motion-ease-out),
    color var(--motion-normal) var(--motion-ease-out),
    border-color var(--motion-normal) var(--motion-ease-out),
    opacity var(--motion-fast) var(--motion-ease-out);
}
button:active:not(:disabled) { transform: scale(var(--motion-press)); }
.conv-item:active:not(:disabled), .reply-quote:active:not(:disabled) { transform: none; }
.conv-item.is-active { box-shadow: inset 3px 0 0 var(--accent); }
.message.is-editing .bubble { outline: 2px solid var(--accent-hi); outline-offset: 2px; }
.composer.is-editing .composer-input { border-color: transparent; }
.typing-line { display: flex; align-items: center; gap: 6px; height: 20px; overflow: hidden; white-space: nowrap; }
.typing-line > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.typing-dots { display: inline-flex; gap: 3px; flex: none; }
.typing-dots i { width: 3px; height: 3px; border-radius: 50%; background: currentColor; animation: typing-dot 1000ms ease-in-out infinite; }
.typing-dots i:nth-child(2) { animation-delay: 120ms; }
.typing-dots i:nth-child(3) { animation-delay: 240ms; }
@keyframes typing-dot { 0%, 65%, 100% { opacity: .45; transform: none; } 30% { opacity: 1; transform: translateY(-2px); } }
#auth-screen:not([hidden]) .auth-card { animation: auth-enter var(--motion-normal) var(--motion-ease-out); }
@keyframes auth-enter { from { opacity: 0; transform: translateY(var(--motion-small-distance)); } to { opacity: 1; transform: none; } }
.modal { overscroll-behavior: contain; }
.modal[open]::backdrop { animation: backdrop-enter var(--motion-normal) var(--motion-ease-out); }
.modal.is-closing::backdrop { animation: backdrop-exit var(--motion-close) var(--motion-ease-in) forwards; }
@keyframes backdrop-enter { from { opacity: 0; } to { opacity: 1; } }
@keyframes backdrop-exit { from { opacity: 1; } to { opacity: 0; } }
.modal.is-anchored { position: fixed; margin: 0; transform-origin: top right; }
#message-actions { width: min(248px, calc(100vw - 24px)); border-radius: var(--radius-surface); }
#message-actions .modal-form { padding: var(--space-2); }
#message-full-time { font-size: var(--type-meta); color: var(--text-muted); margin: var(--space-1) var(--space-2) var(--space-2); }
#message-actions .reaction-picker { flex-wrap: nowrap; gap: 0; padding-bottom: var(--space-2); margin-bottom: var(--space-1); border-bottom: 1px solid var(--border); }
#message-actions .reaction-picker button { flex: 1; min-width: 0; padding: var(--space-2) 0; }
#message-actions .message-action { justify-content: flex-start; padding: var(--space-2); border-radius: var(--radius-small); }
#message-actions .message-action.is-danger-start { border-top: 1px solid var(--border); border-radius: 0 0 var(--radius-small) var(--radius-small); margin-top: var(--space-1); }
#message-actions::backdrop { background: rgba(4,6,9,.28); }
#message-actions .btn-danger { color: var(--danger); }
#message-actions-close { display: none; }
#details-modal { margin: 0 0 0 auto; width: min(440px, 100vw); height: var(--app-height, 100dvh); max-height: var(--app-height, 100dvh); border-radius: 0; }
#details-modal .modal-form { min-height: 100%; display: flex; flex-direction: column; }
#details-modal .member-list { max-height: none; overflow: visible; }
#details-modal .modal-actions { margin-top: auto; padding-block: var(--space-4); }
.inspector-heading { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 2; background: var(--surface-3); padding-bottom: var(--space-2); color: var(--text-muted); font-size: var(--type-meta); }
.details-identity { display: flex; align-items: center; gap: var(--space-4); margin-bottom: var(--space-4); min-width: 0; }
.details-identity > div { min-width: 0; }
.details-identity .avatar { width: 56px; height: 56px; }
.details-identity .modal-title { margin: 0; overflow-wrap: anywhere; }
.details-identity p { margin: var(--space-1) 0 0; font-size: var(--type-meta); color: var(--text-secondary); }
.details-preferences { margin-bottom: var(--space-6); }
.details-preferences summary { cursor: pointer; font-size: var(--type-body); color: var(--text-secondary); padding-block: var(--space-2); }
.details-preferences[open] summary { margin-bottom: var(--space-2); }
.details-preferences .field { margin-bottom: var(--space-2); }
.details-quick-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-2); }
.settings-about { display: flex; align-items: center; gap: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--border); }
.settings-about img { width: 56px; height: 56px; object-fit: contain; flex: none; }
.settings-about h3, .settings-about p { margin: 0; }
.settings-about p { color: var(--text-secondary); font-size: var(--type-meta); }
.member-pagination { display: grid; grid-template-columns: 1fr 1fr; }
#members-page { grid-column: 1 / -1; grid-row: 1; }
.toast { display: flex; align-items: center; gap: 12px; pointer-events: auto; }
.toast .icon-btn { color: inherit; margin-left: auto; }
.toast-host { top: max(12px, env(safe-area-inset-top)); right: 16px; left: auto; bottom: auto; transform: none; max-width: min(420px, calc(100vw - 24px)); }
@media (max-width: 700px) {
  #details-modal { width: 100vw; max-width: 100vw; border-radius: 0; }
  #message-actions { width: min(360px, calc(100vw - 16px)); max-height: calc(var(--app-height, 100dvh) - 16px); margin: auto auto max(8px, env(safe-area-inset-bottom)); }
  #message-actions-close { display: flex; width: 100%; margin-top: var(--space-2); }
  .toast-host { left: 12px; right: 12px; }
}
@media (max-width: 860px) {
  .composer.is-editing .composer-send svg { display: none; }
  .composer.is-editing .composer-send::after { content: 'Save'; font-size: 13px; }
}
.reply-preview {
  opacity: 1;
  transition: opacity var(--motion-close) var(--motion-ease-in), display var(--motion-close) allow-discrete;
}
.reply-preview[hidden] { opacity: 0; }
@media (pointer: coarse) {
  .icon-btn, .btn:not(#composer-send) { min-height: var(--touch-target); }
  .icon-btn { min-width: var(--touch-target); }
  .chip-remove { min-width: 32px; min-height: 32px; }
  .message-menu { position: relative; opacity: 1; }
  .message-menu::after { content: ''; position: absolute; inset: -7px; }
  .reaction-chip { min-height: 44px; min-width: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  button:active:not(:disabled) { transform: none; }
  .typing-dots i { opacity: .8; transform: none; }
}
.privacy-choice { display: flex; gap: .65rem; align-items: center; min-height: 44px; font-size: .875rem; }
.settings-heading { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); position: sticky; top: 0; padding-block: var(--space-3); margin-bottom: var(--space-4); background: var(--surface-3); z-index: 2; }
.settings-heading .modal-title { margin: 0; }
.settings-heading button { min-height: 44px; }
.privacy-choice input { width: 18px; height: 18px; accent-color: var(--accent); }
.restriction-actions { display: flex; flex-direction: column; gap: .6rem; }
.conversation-flags { display: inline-flex; gap: .35rem; margin-inline-start: .4rem; color: var(--text-muted); font-size: .75rem; }
.member-block { flex-shrink: 0; min-height: 44px; }
.member-block, .avatar-controls .link-btn { min-width: var(--touch-target); min-height: var(--touch-target); display: inline-flex; align-items: center; justify-content: center; }
.settings-feedback { margin: var(--space-2) 0 0; }
#blocked-accounts { max-height: 32vh; overflow: auto; }
#account-restricted .auth-card { max-height: calc(100dvh - 2rem); overflow: auto; }
.admin-modal { width: min(640px, calc(100vw - 32px)); }
.admin-modal .btn { min-height: var(--touch-target); }
.admin-sections, .admin-actions, .admin-list-heading { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.admin-sections { margin-bottom: var(--space-6); }
.admin-sections [aria-pressed="true"] { background: var(--surface-2); color: var(--text-primary); }
.admin-actions { margin-top: var(--space-4); }
.admin-list-heading { justify-content: space-between; }
.admin-list-heading .details-heading { margin: 0; }
.admin-history-section { margin-top: var(--space-6); }
.admin-list { list-style: none; padding: 0; margin: 0; }
.admin-list > li { padding-block: var(--space-4); border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.admin-list > li:last-child { border-bottom: 0; }
.admin-list p { margin: var(--space-2) 0; }
.admin-list .btn { margin-top: var(--space-2); }
.announcement-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
#announcement-body { resize: vertical; min-height: 96px; max-height: 32dvh; }
.announcement-counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-3); margin-block: var(--space-4); }
.announcement-counts dt { font-size: var(--type-meta); color: var(--text-secondary); }
.announcement-counts dd { margin: var(--space-1) 0 0; font-size: var(--type-title); font-variant-numeric: tabular-nums; }
.admin-loading { color: var(--text-secondary); min-height: 44px; }

/* One transcript record per row. The server already guarantees each excerpt is
   a single line, so the row never wraps into something that reads as two. */
.admin-report-transcript {
  list-style: none;
  margin: var(--space-2) 0 0;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: var(--type-meta);
}
.admin-report-transcript > li { padding-block: 2px; overflow-wrap: anywhere; }
.admin-report-transcript > li.is-reported { font-weight: var(--weight-control); color: var(--text-primary); }
.admin-report-transcript > li.is-hidden-from-reporter { color: var(--text-secondary); font-style: italic; }
@media (max-width: 480px) {
  .admin-modal .settings-heading { align-items: flex-start; }
  .admin-modal .settings-heading .modal-title { padding-top: var(--space-2); }
  .announcement-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
