/* Harmattan Chat layout. Every colour, radius and font comes from the design system (ds/tokens.css). */
:root {
  color-scheme: dark;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--main-background);
}
*, *::before, *::after { box-sizing: border-box; }
html, body, #root { height: 100%; }
body { margin: 0; padding: 0; overflow: hidden; background: var(--main-background); color: var(--main-Foreground3);
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button { font-family: inherit; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; }
.muted { color: var(--main-Foreground2); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.break { overflow-wrap: anywhere; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 16px; }
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; }
.ds-field { min-width: 0; }
.ds-card { max-width: none; }
.card-title-row { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.section-title { font-size: 14px; margin: 4px 0 0; }
.error-note { margin: 0; font-weight: 500; }
.hc-select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--main-Foreground2) 50%), linear-gradient(135deg, var(--main-Foreground2) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; cursor: pointer; }
:focus-visible { outline: 2px solid var(--main-Foreground3); outline-offset: 2px; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: auto minmax(0, 1fr); height: 100%; }
.shell.with-members { grid-template-columns: auto minmax(0, 1fr) 240px; }
.nav-wrap { display: flex; min-height: 0; height: 100%; }
.rail { width: 72px; flex: none; background: var(--main-filler); display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 0; overflow-y: auto; scrollbar-width: none; border-right: 2px solid var(--main-background);
  padding-left: env(safe-area-inset-left, 0px); }
.rail-sep { width: 28px; height: 2px; background: var(--main-background); border-radius: 2px; margin: 2px 0; flex: none; }
.tile { position: relative; width: 48px; height: 48px; flex: none; border: 2px solid transparent; border-radius: var(--radius);
  background: var(--main-background); color: var(--main-Foreground3); font-weight: 600; font-size: 15px; cursor: pointer;
  display: grid; place-items: center; transition: border-color .12s, background .12s; }
.tile:hover { border-color: var(--main-Foreground2); }
.tile.active { background: var(--main-Foreground3); color: var(--main-filler); border-color: var(--main-Foreground3); }
.home-tile img { width: 20px; height: auto; display: block; }
.home-tile.active img { filter: invert(1) brightness(.2); }
.add-tile { background: transparent; border: 2px dashed var(--main-Foreground2); color: var(--main-Foreground2); font-size: 22px; font-weight: 400; }
.add-tile:hover { color: var(--main-Foreground3); border-color: var(--main-Foreground3); }
.pip { position: absolute; left: -14px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--main-Foreground3); }

.side { width: 248px; flex: none; background: var(--main-filler); display: flex; flex-direction: column; min-height: 0; }
.side-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding: 16px 12px 12px 18px; border-bottom: 2px solid var(--main-background); min-height: 64px; }
.side-head h2 { margin: 0; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-scroll { flex: 1; overflow-y: auto; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.side-heading { font-size: 12px; font-weight: 500; color: var(--main-Foreground2); padding: 14px 10px 6px; margin: 0; }
.side-action { padding: 6px 4px; }
.side-empty { color: var(--main-Foreground2); font-size: 12px; padding: 0 10px; margin: 0; }
.nav-item { appearance: none; border: 0; background: transparent; width: 100%; text-align: left; display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: var(--radius); color: var(--main-Foreground2); font: inherit; font-weight: 500; cursor: pointer; min-height: 38px; }
.nav-item:hover { color: var(--main-Foreground3); background: var(--main-background); }
.nav-item.active { background: var(--main-background); color: var(--main-Foreground3); box-shadow: inset 2px 0 0 var(--main-Foreground3); }
.nav-item.unread { color: var(--main-Foreground3); font-weight: 600; }
.nav-item.dim { opacity: .6; }
.nav-item .hash { width: 14px; text-align: center; font-weight: 400; opacity: .8; }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.you { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border-top: 2px solid var(--main-background);
  padding-bottom: max(10px, env(safe-area-inset-bottom, 0px)); }
.you-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.you-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Avatars ---------- */
.avatar { position: relative; flex: none; display: inline-grid; place-items: center; border-radius: var(--radius);
  background: var(--main-filler); color: var(--main-Foreground3); font-weight: 600; letter-spacing: .02em; }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; border-radius: calc(var(--radius) - 4px); }
.avatar-md { width: 38px; height: 38px; font-size: 13px; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; }
.avatar-xl { width: 88px; height: 88px; font-size: 28px; border-radius: calc(var(--radius) + 6px); }
.avatar-xs { width: 20px; height: 20px; font-size: 9px; border-radius: 6px; }
.avatar-dot { width: 14px; height: 14px; background: transparent !important; }
.avatar-dot .presence { right: 0; bottom: 0; box-shadow: none; }
.avatar.has-photo img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.avatar.speaking { box-shadow: 0 0 0 2px var(--main-background), 0 0 0 4px var(--main-Foreground3); }
.avatar-xl .presence { width: 20px; height: 20px; right: -2px; bottom: -2px; box-shadow: 0 0 0 4px var(--main-filler); }
.avatar-bot { box-shadow: inset 0 0 0 2px var(--main-Foreground2); }
.side .avatar, .members .avatar, .modal .avatar { background: var(--main-background); }
/* Presence: shapes, not colors, so it reads in monochrome.
   online = solid white, idle = white ring, do not disturb = white with a bar, offline = grey ring. */
.presence { position: absolute; right: -3px; bottom: -3px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--main-filler); border: 2px solid var(--main-Foreground2); box-shadow: 0 0 0 2px var(--main-filler); }
.presence-online { background: var(--main-Foreground3); border-color: var(--main-Foreground3); }
.presence-idle { background: var(--main-filler); border: 3px solid var(--main-Foreground3); }
.presence-dnd { background: var(--main-Foreground3); border-color: var(--main-Foreground3); }
.presence-dnd::after { content: ""; position: absolute; left: 1px; right: 1px; top: 50%; height: 2px; margin-top: -1px; background: var(--main-filler); border-radius: 1px; }
.main .presence { box-shadow: 0 0 0 2px var(--main-background); }
.avatar-btn { appearance: none; border: 0; padding: 0; background: none; cursor: pointer; border-radius: var(--radius); }

/* ---------- Main / chat ---------- */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; position: relative; }
.chat-header { display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap; padding: 14px 24px; min-height: 64px; border-bottom: 2px solid var(--main-filler); }
.chat-title { flex: 1; min-width: 160px; }
.chat-title h1 { margin: 0; font-size: 19px; line-height: 1.25; overflow-wrap: anywhere; }
.chat-title h1 .hash { color: var(--main-Foreground2); font-weight: 400; margin-right: 3px; }
.chat-title p { margin: 1px 0 0; font-size: 13px; color: var(--main-Foreground2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-btn { display: none !important; }
.scroll { position: relative; flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 6px 0 10px; }
.intro { padding: 32px 24px 8px; max-width: 640px; }
.intro h2 { margin: 0 0 4px; font-size: 22px; }
.intro p { margin: 0; color: var(--main-Foreground2); }
.empty-line { color: var(--main-Foreground2); padding: 16px 24px; margin: 0; }
.day { display: flex; align-items: center; gap: 14px; margin: 20px 24px 4px; color: var(--main-Foreground2); font-size: 12px; font-weight: 500; }
.day::before, .day::after { content: ""; flex: 1; height: 2px; background: var(--main-filler); border-radius: 2px; }
.new-line { color: var(--main-Foreground3); font-weight: 600; }
.new-line::before, .new-line::after { background: var(--main-Foreground3); height: 1px; }
.chat-title h1 .ds-badge { vertical-align: 3px; margin-left: 6px; }
.count-badge { min-width: 22px; justify-content: center; }

.msg { position: relative; display: grid; grid-template-columns: 52px minmax(0, 1fr); padding: 2px 24px; outline: none; }
.msg.head { margin-top: 12px; padding-top: 6px; }
.msg:hover, .msg:focus-within { background: var(--main-filler); }
.msg-gutter { padding-top: 2px; }
.msg-hover-time { display: block; font-size: 11px; line-height: 21px; color: var(--main-Foreground2); opacity: 0; white-space: nowrap; }
.msg:hover .msg-hover-time, .msg:focus-within .msg-hover-time { opacity: 1; }
.msg-meta { display: flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; }
.msg-author { appearance: none; border: 0; background: none; padding: 0; color: var(--main-Foreground3); font: inherit; font-weight: 600; cursor: pointer; }
.msg-author:hover { text-decoration: underline; text-underline-offset: 3px; }
.msg-meta time { font-size: 12px; color: var(--main-Foreground2); }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 76ch; }
.msg-text a { color: var(--main-Foreground3); text-decoration: underline; text-underline-offset: 2px; }
.msg-text .ds-badge { margin-left: 8px; vertical-align: 1px; }
.msg-edited { font-size: 11px; color: var(--main-Foreground2); }
.msg-edit { display: flex; flex-direction: column; gap: 8px; padding: 4px 0 6px; max-width: 760px; }
.msg-edit-actions { display: flex; gap: 8px; justify-content: flex-end; }
.msg-actions { position: absolute; top: 2px; right: 16px; display: flex; align-items: center; gap: 2px; padding: 3px;
  background: var(--main-background); border-radius: var(--radius); opacity: 0; pointer-events: none; }
.msg:hover .msg-actions, .msg:focus-within .msg-actions { opacity: 1; pointer-events: auto; }
@media (hover: none) { .msg:hover:not(:focus-within) .msg-actions { opacity: 0; pointer-events: none; } }
.confirm { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.confirm-text { font-weight: 500; font-size: 13px; padding: 0 4px; }

.typing { min-height: 22px; padding: 0 24px; font-size: 12px; color: var(--main-Foreground2); }
.composer { display: flex; align-items: flex-start; gap: 10px; padding: 2px 24px 18px; }
.composer .ds-field { flex: 1; }
.composer .ds-btn { flex: none; min-height: 44px; }
.readonly-note { margin: 2px 24px 18px; padding: 12px 16px; border-radius: var(--radius); background: var(--main-filler); color: var(--main-Foreground2);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.status-bar { padding: 8px 24px; background: var(--main-filler); color: var(--main-Foreground2); font-size: 13px; border-bottom: 2px solid var(--main-background); }

/* Lists used in friends + settings */
.rows { list-style: none; margin: 0; padding: 4px 16px; display: flex; flex-direction: column; gap: 2px; }
.modal .rows { padding: 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 10px; border-radius: var(--radius); flex-wrap: wrap; }
.row:hover { background: var(--main-filler); }
.modal .row:hover { background: var(--main-background); }
.row-text { flex: 1; min-width: 160px; display: flex; flex-direction: column; line-height: 1.35; }
.row-title { font-weight: 600; display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-sub { font-size: 12px; color: var(--main-Foreground2); }
.row-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.row-actions.start { justify-content: flex-start; }
.empty { padding: 40px 24px; color: var(--main-Foreground2); max-width: 520px; }
.empty h2 { color: var(--main-Foreground3); font-size: 17px; margin: 0 0 4px; }
.empty p { margin: 0; }
.empty-action { margin-top: 16px; }
.panel-narrow { padding: 28px 24px; max-width: 620px; }
.panel-narrow .section-title { font-size: 17px; }
.panel-narrow > p { margin: 4px 0 16px; }
.inline-form { display: flex; align-items: flex-start; gap: 10px; }
.inline-form .ds-field { flex: 1; }
.inline-form > .ds-btn { margin-top: 25px; min-height: 44px; }
.inline-form.tight { flex-direction: column; align-items: stretch; }
.inline-form.tight > .ds-btn { margin-top: 0; justify-content: center; }

/* ---------- Members ---------- */
.members { background: var(--main-filler); overflow-y: auto; padding: 8px 10px 16px; border-left: 2px solid var(--main-background); }
.member-group h3 { font-weight: 500; }

/* ---------- Modals ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .6); display: grid; place-items: center; padding: 20px;
  padding-top: max(20px, env(safe-area-inset-top, 0px)); padding-bottom: max(20px, env(safe-area-inset-bottom, 0px)); }
.modal { background: var(--main-filler); border-radius: var(--radius); width: 100%; max-height: 100%; display: flex; flex-direction: column; min-height: 0; }
.modal-sm { max-width: 460px; }
.modal-md { max-width: 620px; }
.modal-lg { max-width: 860px; height: min(780px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 10px 24px; }
.modal-head h2 { margin: 0; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { padding: 8px 24px 22px; overflow-y: auto; min-height: 0; flex: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px 20px; border-top: 2px solid var(--main-background); }
.modal .ds-card { background: var(--main-background); }
.modal .ds-card .ds-input, .modal .ds-card .ds-tabs { background: var(--main-filler); }
.modal .ds-card .ds-tab-selected { background: var(--main-background); }
.modal .ds-card .ds-btn-secondary, .modal .ds-card .ds-btn-danger { background: var(--main-filler); }
.settings { display: flex; flex-direction: column; gap: 18px; height: 100%; }
.settings-tabs { overflow-x: auto; scrollbar-width: thin; flex: none; }
.settings-body { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -24px; padding: 2px 24px 8px; }
.modal-lg .modal-body { overflow: hidden; display: flex; flex-direction: column; }
.split { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.split-list { display: flex; flex-direction: column; gap: 12px; }
.pick-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.pick-list .nav-item:hover, .pick-list .nav-item.active { background: var(--main-background); }
.perm-list { display: flex; flex-direction: column; gap: 4px; }
.perm { padding: 6px 0; }
.perm p { margin: 2px 0 0 28px; }
.code { margin: 0; padding: 14px 16px; background: var(--main-filler); border-radius: var(--radius); font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px; line-height: 1.6; overflow-x: auto; white-space: pre; color: var(--main-Foreground3); }
.modal .code { background: var(--main-background); }
.modal .ds-card .code { background: var(--main-filler); }
.copy-field { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.copy-field .ds-field { flex: 1; min-width: 220px; }
.copy-field .ds-input { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; }
.copy-field:has(.ds-field-hint) .copy-actions { margin-bottom: 24px; }
.copy-actions { display: flex; gap: 6px; padding-bottom: 4px; }
.log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.log-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.log-time { margin-left: auto; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 14px; border-top: 2px solid var(--main-background); }
.danger-zone p { margin: 2px 0 0; }
.profile { display: flex; flex-direction: column; gap: 14px; }
.profile-head { display: flex; align-items: center; gap: 16px; }
.profile-name { font-size: 18px; font-weight: 600; }
.profile-bio { margin: 0; }
.profile-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding-top: 4px; }

/* ---------- Auth, boot, invite ---------- */
.center { flex: 1; height: 100%; display: grid; place-items: center; padding: 24px; }
.center .ds-card { width: min(440px, 100%); }
.boot { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.boot img { width: 42px; }
.auth { height: 100%; overflow-y: auto; display: grid; place-items: center; padding: 32px 20px; }
.auth-panel { width: min(420px, 100%); display: flex; flex-direction: column; gap: 18px; }
.auth-logo { width: 40px; height: auto; }
.auth h1 { margin: 6px 0 -10px; font-size: 30px; line-height: 1.15; letter-spacing: -0.02em; }
.auth .muted { margin: 0; }
.auth .ds-tabs { align-self: flex-start; }
.auth .ds-btn-lg { justify-content: center; }

/* ---------- Toast ---------- */
.toast { position: fixed; z-index: 80; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  max-width: min(520px, calc(100vw - 32px)); padding: 12px 18px; border-radius: var(--radius); background: var(--main-Foreground3); color: var(--main-filler); font-weight: 500; }
.toast-error { background: var(--main-filler); color: var(--main-Foreground3); border: 2px solid var(--main-rareAccent); }
.scrim { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .shell.with-members { grid-template-columns: auto minmax(0, 1fr); }
  .members { display: none; }
}
@media (max-width: 760px) {
  .shell, .shell.with-members { grid-template-columns: minmax(0, 1fr); }
  .nav-wrap { position: fixed; z-index: 50; top: 0; bottom: 0; left: 0; max-width: 92vw; transform: translateX(-102%); transition: transform .2s ease;
    padding-top: env(safe-area-inset-top, 0px); background: var(--main-filler); }
  .nav-wrap.open { transform: none; }
  .side { width: min(260px, calc(92vw - 72px)); }
  .scrim { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(0, 0, 0, .55); }
  .menu-btn { display: inline-flex !important; }
  .chat-header { padding: 10px 14px; }
  .chat-header .ds-tabs { order: 5; width: 100%; overflow-x: auto; }
  .chat-header .ds-tab { flex: 1; padding: 8px 8px; white-space: nowrap; }
  .chat-title { min-width: 0; }
  .msg { padding-left: 10px; padding-right: 10px; grid-template-columns: 48px minmax(0, 1fr); }
  .msg-actions { right: 6px; }
  .day, .intro, .typing, .empty-line { margin-left: 0; margin-right: 0; padding-left: 14px; padding-right: 14px; }
  .day { margin: 18px 14px 4px; padding: 0; }
  .composer { padding: 2px 10px 12px; }
  .readonly-note { margin: 2px 10px 12px; }
  .rows { padding: 4px 6px; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .overlay { padding: 0; }
  .modal { border-radius: 0; height: 100%; max-width: none; }
  .modal-body { padding: 8px 16px 20px; }
  .settings-body { margin: 0 -16px; padding: 2px 16px 8px; }
  .modal-head { padding: 14px 12px 8px 16px; }
  .inline-form { flex-direction: column; align-items: stretch; }
  .inline-form > .ds-btn { margin-top: 0; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Profiles ---------- */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); }
.swatch.none { background: var(--main-background); border-color: var(--main-Foreground2); position: relative; }
.swatch.none::after { content: ""; position: absolute; left: 4px; right: 4px; top: 50%; height: 2px; margin-top: -1px; background: var(--main-Foreground2); transform: rotate(-45deg); }
.swatch.selected { box-shadow: 0 0 0 2px var(--main-filler), 0 0 0 4px var(--main-Foreground3); }
.profile .profile-banner, .profile-preview .profile-banner { height: 72px; margin: -8px -24px 0; background: var(--main-background); }
.profile-preview { background: var(--main-background); border-radius: var(--radius); overflow: hidden; padding: 0 18px 18px; }
.profile-preview .profile-banner { margin: 0 -18px; background: var(--main-filler); }
.profile .profile-head, .profile-preview .profile-head { margin-top: -40px; align-items: flex-end; }
.profile-id { padding-bottom: 4px; min-width: 0; }
.profile-id .small { margin-top: 2px; }
.profile-preview .profile-bio { margin: 12px 0 0; }
.profile-editor { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 28px; align-items: start; }
.member-text { display: flex; flex-direction: column; line-height: 1.2; }
.member-name { overflow: hidden; text-overflow: ellipsis; }
.member-status { font-size: 11px; font-weight: 400; color: var(--main-Foreground2); overflow: hidden; text-overflow: ellipsis; }
.you-btn { appearance: none; border: 0; background: none; color: inherit; font: inherit; flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px;
  padding: 4px; margin: -4px; border-radius: var(--radius); cursor: pointer; text-align: left; }
.you-btn:hover { background: var(--main-background); }
.you-status { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-list { display: flex; flex-direction: column; gap: 2px; }
.status-option { min-height: 52px; gap: 12px; }
.status-option .row-text { min-width: 0; }

/* ---------- Badges ---------- */
.badge-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.badge-item { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 14px; align-items: start; padding: 10px; border-radius: var(--radius); background: var(--main-background); }
.badge-item .ds-badge { justify-self: start; }
.progress { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.progress-track { flex: 1; max-width: 220px; height: 6px; border-radius: 999px; background: var(--main-filler); overflow: hidden; }
.progress-fill { display: block; height: 100%; background: var(--main-Foreground3); border-radius: inherit; }

/* ---------- Voice and video ---------- */
.voice-people { list-style: none; margin: 0 0 4px; padding: 0 0 0 30px; display: flex; flex-direction: column; gap: 2px; }
.voice-people li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--main-Foreground2); min-height: 26px; }
.call-lobby { padding: 40px 24px; display: flex; flex-direction: column; gap: 16px; max-width: 560px; }
.call-lobby h2 { margin: 0; font-size: 22px; }
.call-lobby.compact { padding: 14px 24px; gap: 10px; flex-direction: row; flex-wrap: wrap; align-items: center; max-width: none; }
.lobby-people { display: flex; flex-wrap: wrap; gap: 8px; }
.lobby-person { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--main-filler); font-size: 13px; }
.call-stage { padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 16px; }
.call-stage.compact { padding: 12px 24px; }
.call-tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.call-tiles-1 { grid-template-columns: minmax(0, 720px); justify-content: center; }
.call-tiles-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.call-stage.compact .call-tiles { grid-template-columns: repeat(auto-fill, minmax(180px, 240px)); }
.call-tile { position: relative; aspect-ratio: 16 / 10; border-radius: var(--radius); background: var(--main-filler); display: grid; place-items: center; overflow: hidden;
  box-shadow: inset 0 0 0 2px transparent; transition: box-shadow .12s; }
.call-tile.speaking { box-shadow: inset 0 0 0 3px var(--main-Foreground3); }
.call-tile-video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.call-tile-video.mirror { transform: scaleX(-1); }
.call-tile-label { position: absolute; left: 10px; bottom: 10px; right: 10px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.call-tile-name { padding: 3px 10px; border-radius: 999px; background: rgba(35, 35, 35, .85); font-size: 13px; font-weight: 500; }
.call-controls { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.call-controls.compact { justify-content: flex-start; gap: 4px; }
.call-controls.compact .ds-btn { padding: 4px 9px; }
.call-bar { padding: 10px 12px; border-top: 2px solid var(--main-background); display: flex; flex-direction: column; gap: 8px; }
.call-bar-title { appearance: none; border: 0; background: none; color: inherit; font: inherit; text-align: left; padding: 0; cursor: pointer; display: flex; flex-direction: column; }
.call-bar-status { font-weight: 600; font-size: 13px; }
.call-bar-title:hover .call-bar-status { text-decoration: underline; text-underline-offset: 3px; }
.dm-call { border-bottom: 2px solid var(--main-filler); }
.ring { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 24px; background: var(--main-Foreground3); color: var(--main-filler); }
.ring span { flex: 1; min-width: 160px; }
.ring .ds-btn-primary { background: var(--main-filler); color: var(--main-Foreground3); border-color: var(--main-filler); }
.ring .ds-btn-ghost { color: var(--main-filler); }
.ring .ds-btn-ghost:hover { background: rgba(0,0,0,.08); color: var(--main-filler); }
@media (max-width: 760px) {
  .profile-editor { grid-template-columns: minmax(0, 1fr); }
  .badge-item { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .call-tiles, .call-tiles-2 { grid-template-columns: minmax(0, 1fr); }
  .call-stage, .call-lobby { padding-left: 12px; padding-right: 12px; }
  .ring { padding: 10px 12px; }
}
.profile .profile-head, .profile-preview .profile-head { position: relative; z-index: 1; }
.profile .avatar-xl { box-shadow: 0 0 0 5px var(--main-filler); }
.profile-preview .avatar-xl { box-shadow: 0 0 0 5px var(--main-background); }
.profile .avatar-xl.speaking, .profile-preview .avatar-xl.speaking { box-shadow: 0 0 0 5px var(--main-filler), 0 0 0 7px var(--main-Foreground3); }
.profile .profile-head, .profile-preview .profile-head { align-items: flex-start; }
.profile .profile-id, .profile-preview .profile-id { padding-top: 46px; }

/* ---------- Mentions ---------- */
.mention { padding: 0 3px; border-radius: 4px; background: var(--main-filler); font-weight: 600; }
.mention-me { background: var(--main-Foreground3); color: var(--main-filler); }
.msg.mentioned { box-shadow: inset 2px 0 0 var(--main-Foreground3); background: rgba(255, 255, 255, .035); }
.msg.flash { animation: flash 2.4s ease-out; }
@keyframes flash { 0%, 30% { background: rgba(255, 255, 255, .14); } 100% { background: transparent; } }
.tile-count { position: absolute; right: -6px; bottom: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
  background: var(--main-Foreground3); color: var(--main-filler); font-size: 11px; font-weight: 700; display: grid; place-items: center;
  box-shadow: 0 0 0 3px var(--main-filler); }
.suggest { position: absolute; left: 24px; right: 24px; bottom: 100%; margin: 0 0 6px; padding: 6px; list-style: none; z-index: 20;
  background: var(--main-filler); border: 2px solid var(--main-Foreground2); border-radius: var(--radius); max-height: 280px; overflow-y: auto; }
.suggest-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: calc(var(--radius) - 4px); cursor: pointer; }
.suggest-item.active, .suggest-item:hover { background: var(--main-background); }
.suggest-name { font-weight: 600; }

/* ---------- Composer, files ---------- */
.composer-wrap { position: relative; }
.composer > .ds-btn-secondary { min-height: 44px; }
.chat-area { display: flex; flex-direction: column; min-height: 0; height: 100%; position: relative; }
.chat-area.dropping::after, .side-panel.dropping::after { content: "Drop files to attach them"; position: absolute; inset: 12px; z-index: 30; display: grid; place-items: center;
  border: 2px dashed var(--main-Foreground3); border-radius: var(--radius); background: rgba(35, 35, 35, .88); font-weight: 600; font-size: 16px; }
.pending-files { list-style: none; margin: 0; padding: 4px 24px 8px; display: flex; flex-wrap: wrap; gap: 8px; }
.pending { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 6px; border-radius: var(--radius); background: var(--main-filler); max-width: 320px; }
.pending.failed { box-shadow: inset 0 0 0 2px var(--main-rareAccent); }
.pending img, .pending-ext { width: 44px; height: 44px; border-radius: calc(var(--radius) - 4px); object-fit: cover; flex: none; }
.pending-ext { display: grid; place-items: center; background: var(--main-background); font-size: 11px; font-weight: 700; color: var(--main-Foreground2); }
.pending-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.pending-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachments { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; margin: 6px 0 2px; }
.att-image { display: block; border-radius: var(--radius); overflow: hidden; max-width: min(400px, 100%); background: var(--main-filler); line-height: 0; }
.att-image img { max-width: 100%; max-height: 320px; height: auto; width: auto; display: block; object-fit: contain; }
.att-file { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; min-width: 220px; max-width: 360px; border-radius: var(--radius);
  background: var(--main-filler); border: 2px solid var(--main-Foreground2); color: var(--main-Foreground3); text-decoration: none; }
.att-file:hover { border-color: var(--main-Foreground3); }
.att-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Reactions ---------- */
.reactions { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.reaction { appearance: none; font: inherit; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; min-height: 28px;
  border-radius: 999px; border: 1px solid var(--main-Foreground2); background: var(--main-filler); color: var(--main-Foreground3); cursor: pointer; }
.reaction:hover { border-color: var(--main-Foreground3); }
.reaction.mine { border: 2px solid var(--main-Foreground3); padding: 1px 9px; font-weight: 600; }
.reaction.add { color: var(--main-Foreground2); font-size: 16px; padding: 0 10px; }
.reaction-emoji { font-size: 15px; line-height: 1; }
.picker-anchor { position: relative; display: inline-flex; }
.picker { position: absolute; z-index: 40; right: 0; bottom: calc(100% + 6px); display: grid; grid-template-columns: repeat(6, 36px); gap: 2px; padding: 6px;
  background: var(--main-filler); border: 2px solid var(--main-Foreground2); border-radius: var(--radius); }
.reactions .picker { left: 0; right: auto; }
.picker-emoji { appearance: none; border: 0; background: none; width: 36px; height: 36px; border-radius: calc(var(--radius) - 4px); font-size: 20px; cursor: pointer; }
.picker-emoji:hover, .picker-emoji:focus-visible { background: var(--main-background); }
.msg-actions.open { opacity: 1; pointer-events: auto; }

/* ---------- Threads and side panels ---------- */
.thread-link { appearance: none; border: 0; background: none; padding: 4px 0; margin-top: 2px; color: var(--main-Foreground3); font: inherit; font-weight: 600; font-size: 13px;
  cursor: pointer; display: inline-flex; gap: 10px; align-items: baseline; }
.thread-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.shell.with-panel { grid-template-columns: auto minmax(0, 1fr) 380px; }
.side-panel { background: var(--main-background); border-left: 2px solid var(--main-filler); display: flex; flex-direction: column; min-height: 0; height: 100%; position: relative; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 12px 20px; min-height: 64px; border-bottom: 2px solid var(--main-filler); }
.panel-head h2 { margin: 0; font-size: 17px; }
.panel-head p { margin: 0; }
.panel-body { padding: 14px 20px; }
.side-panel .msg { padding-left: 16px; padding-right: 12px; }
.side-panel .msg-actions { right: 8px; }
.side-panel .day { margin-left: 16px; margin-right: 16px; }
.side-panel .composer, .side-panel .pending-files { padding-left: 12px; padding-right: 12px; }
.side-panel .composer > .ds-btn-secondary { padding-left: 11px; padding-right: 11px; }
.side-panel .suggest { left: 12px; right: 12px; }
.results { list-style: none; margin: 0; padding: 0 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.results.wide { padding: 8px 24px 24px; max-width: 820px; }
.result { appearance: none; width: 100%; text-align: left; border: 0; font: inherit; color: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 4px;
  padding: 12px 14px; border-radius: var(--radius); background: var(--main-filler); }
.result:hover { box-shadow: inset 0 0 0 2px var(--main-Foreground2); }
.result-head { display: flex; align-items: center; gap: 8px; }
.result-text { overflow-wrap: anywhere; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.result-text mark { background: var(--main-Foreground3); color: var(--main-filler); border-radius: 3px; padding: 0 2px; }
@media (max-width: 1100px) {
  .shell.with-panel { grid-template-columns: auto minmax(0, 1fr); }
  .side-panel { position: fixed; z-index: 55; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
}
@media (max-width: 760px) {
  .pending-files { padding-left: 10px; padding-right: 10px; }
  .suggest { left: 10px; right: 10px; }
  .results.wide { padding: 8px 10px 20px; }
  .composer > .ds-btn-secondary { padding-left: 11px; padding-right: 11px; }
}

/* ---------- Markdown ---------- */
.inline-code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .9em; padding: 1px 5px; border-radius: 5px; background: var(--main-filler); }
.code-block { margin: 6px 0; padding: 10px 14px; border-radius: var(--radius); background: var(--main-filler); overflow-x: auto; max-width: 100%;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; line-height: 1.55; white-space: pre; }
.msg-text blockquote { margin: 4px 0; padding: 2px 0 2px 12px; border-left: 3px solid var(--main-Foreground2); color: var(--main-Foreground3); white-space: pre-wrap; }
.spoiler { background: var(--main-Foreground2); color: transparent; border-radius: 4px; cursor: pointer; padding: 0 2px; }
.spoiler * { visibility: hidden; }
.spoiler.shown { background: var(--main-filler); color: inherit; cursor: auto; }
.spoiler.shown * { visibility: visible; }
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { transition: none !important; animation: none !important; }

/* ---------- Polls ---------- */
.poll { margin: 6px 0; padding: 14px; border-radius: var(--radius); background: var(--main-filler); max-width: 520px; display: flex; flex-direction: column; gap: 10px; }
.poll-q { font-weight: 600; font-size: 15px; }
.poll-options { display: flex; flex-direction: column; gap: 6px; }
.poll-option { position: relative; overflow: hidden; appearance: none; text-align: left; font: inherit; color: var(--main-Foreground3); cursor: pointer;
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: calc(var(--radius) - 4px); border: 2px solid var(--main-Foreground2); background: var(--main-background); }
.poll-option:hover:not(:disabled) { border-color: var(--main-Foreground3); }
.poll-option.chosen { border-color: var(--main-Foreground3); font-weight: 600; }
.poll-option:disabled { cursor: default; }
.poll-bar { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(255, 255, 255, .12); }
.poll-text { position: relative; flex: 1; }
.poll-pct { position: relative; font-weight: 600; font-size: 13px; }
.poll-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.poll-edit-row { display: flex; align-items: flex-end; gap: 8px; }
.poll-edit-row .ds-field { flex: 1; }

/* ---------- Categories, switcher ---------- */
.cat-heading { appearance: none; border: 0; background: none; font: inherit; font-size: 12px; font-weight: 500; color: var(--main-Foreground2); cursor: pointer;
  display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; }
.cat-heading:hover { color: var(--main-Foreground3); }
.cat-arrow { width: 10px; font-size: 10px; }
.switcher { padding: 16px; gap: 10px; }
.switcher-list { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.switch-kind { width: 20px; text-align: center; color: var(--main-Foreground2); }
.switcher-empty { padding: 10px; }
.switcher-hint { margin: 0; }

/* ---------- Admin ---------- */
.admin { display: grid; grid-template-columns: 240px minmax(0, 1fr); height: 100%; }
.admin-nav { background: var(--main-filler); padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; border-right: 2px solid var(--main-background); }
.admin-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 16px; }
.admin-brand img { width: 26px; }
.admin-brand div { display: flex; flex-direction: column; line-height: 1.25; }
.admin-exit { margin-top: auto; padding: 16px 4px 0; }
.admin-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.admin-top { padding: 18px 32px; border-bottom: 2px solid var(--main-filler); }
.admin-top h1 { margin: 0; font-size: 22px; }
.admin-body { flex: 1; overflow-y: auto; padding: 24px 32px 48px; display: flex; flex-direction: column; gap: 20px; }
.admin-h { margin: 0; font-size: 20px; }
.admin-section { display: flex; flex-direction: column; gap: 12px; }
.admin-section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.admin-section-head h2 { margin: 0; font-size: 16px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.stat { background: var(--main-filler); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; }
.stat-value { font-size: 28px; font-weight: 600; line-height: 1.1; letter-spacing: -0.02em; }
.stat-label { font-weight: 500; }
.bars { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; height: 180px; align-items: end; padding: 12px; background: var(--main-filler); border-radius: var(--radius); }
.bar-col { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; }
.bar { width: 100%; max-width: 28px; background: var(--main-Foreground3); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar-label { font-size: 10px; color: var(--main-Foreground2); white-space: nowrap; }
.admin-filters { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.admin-filters > .ds-field { flex: 1; min-width: 200px; max-width: 420px; }
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th { text-align: left; font-weight: 500; font-size: 12px; color: var(--main-Foreground2); padding: 8px 12px; border-bottom: 2px solid var(--main-filler); white-space: nowrap; }
.admin-table td { padding: 10px 12px; border-bottom: 1px solid var(--main-filler); vertical-align: middle; }
.admin-table tr.clickable { cursor: pointer; }
.admin-table tr.clickable:hover, .admin-table tr.clickable:focus-visible { background: var(--main-filler); outline: none; }
.cell-user { display: flex; align-items: center; gap: 10px; }
.row.clickable { cursor: pointer; }
.admin-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; align-items: start; }
.admin-person { margin-top: 0; align-items: center; }
.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.link { appearance: none; border: 0; background: none; padding: 0; font: inherit; color: var(--main-Foreground3); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; text-align: left; }
.admin-messages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.admin-msg { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius); background: var(--main-filler); }
.admin-msg-main { flex: 1; min-width: 0; }
.admin-msg-meta { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.admin-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: calc(var(--radius) - 4px); flex: none; }
.audit { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.audit-row { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 14px; padding: 9px 4px; border-bottom: 1px solid var(--main-filler); font-size: 14px; }
.string-group { background: var(--main-background); border-radius: var(--radius); padding: 4px 14px; }
.string-group summary { cursor: pointer; padding: 10px 0; font-weight: 600; text-transform: capitalize; }
.string-list { display: flex; flex-direction: column; gap: 12px; padding: 4px 0 14px; }
.string-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 14px; align-items: center; }
.string-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 860px) {
  .admin { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .admin-nav { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; padding: 10px; border-right: 0; border-bottom: 2px solid var(--main-background); }
  .admin-nav .nav-item { width: auto; white-space: nowrap; }
  .admin-brand, .admin-exit { display: none; }
  .admin-top, .admin-body { padding-left: 14px; padding-right: 14px; }
  .string-row, .audit-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
}

/* ---------- Link previews, bot buttons, ephemeral replies ---------- */
.embeds { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 2px; max-width: 520px; }
.embed { display: flex; gap: 14px; padding: 12px 14px; border-radius: var(--radius); background: var(--main-filler); border-left: 3px solid var(--main-Foreground2);
  color: var(--main-Foreground3); text-decoration: none; }
.embed:hover { border-left-color: var(--main-Foreground3); }
.embed-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.embed-site { font-size: 12px; color: var(--main-Foreground2); }
.embed-title { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.embed-desc { font-size: 13px; color: var(--main-Foreground2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.embed-img { width: 96px; height: 96px; object-fit: cover; border-radius: calc(var(--radius) - 4px); flex: none; }
.components { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 2px; }
.component-row { display: flex; flex-wrap: wrap; gap: 6px; }
.link-btn { text-decoration: none; }
.msg-interaction { padding: 0 0 2px 0; grid-column: 2; }
.msg.ephemeral { background: rgba(255, 255, 255, .04); box-shadow: inset 2px 0 0 var(--main-Foreground2); }
.ephemeral-note { color: var(--main-Foreground2); margin-top: 4px; display: flex; gap: 10px; align-items: baseline; }
.command-hint { margin: 0; padding: 4px 24px 6px; }

/* ---------- Custom emoji ---------- */
.custom-emoji { width: 22px; height: 22px; object-fit: contain; vertical-align: -5px; display: inline-block; }
.custom-emoji.small { width: 18px; height: 18px; vertical-align: -3px; }
.msg-text:not(:has(*:not(.custom-emoji))) .custom-emoji:only-child { width: 44px; height: 44px; }
.picker-section { grid-column: 1 / -1; font-size: 11px; color: var(--main-Foreground2); padding: 6px 4px 2px; }
.picker-emoji .custom-emoji { width: 24px; height: 24px; vertical-align: middle; }
.emoji-add { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.emoji-add .ds-field { flex: 1; min-width: 180px; }
.emoji-preview { width: 44px; height: 44px; object-fit: contain; border-radius: 8px; background: var(--main-filler); display: inline-block; }
.emoji-preview.empty { border: 2px dashed var(--main-Foreground2); background: transparent; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.emoji-cell { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius); background: var(--main-background); }
.emoji-cell code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Events, keybinds ---------- */
.event { padding: 14px 16px; border-radius: var(--radius); background: var(--main-background); display: flex; flex-direction: column; gap: 4px; }
.event-when { font-size: 13px; font-weight: 600; }
.event-title { font-size: 17px; font-weight: 600; }
.event-desc { margin: 4px 0 0; white-space: pre-wrap; }
.event .row-actions { margin-top: 6px; }
.key-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 4px 0; }
.key-label { flex: 1; min-width: 160px; }
.kbd { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--main-Foreground2);
  background: var(--main-background); min-width: 90px; text-align: center; }
.modal .ds-card .kbd { background: var(--main-filler); }

/* ---------- Forums and media ---------- */
.tag-filter { display: flex; flex-wrap: wrap; gap: 6px; padding: 14px 24px 4px; }
.tag-chip { appearance: none; font: inherit; font-size: 13px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--main-Foreground2); background: transparent; color: var(--main-Foreground2); cursor: pointer; }
.tag-chip.on { border: 2px solid var(--main-Foreground3); color: var(--main-Foreground3); font-weight: 600; padding: 3px 11px; }
.post-list { list-style: none; margin: 0; padding: 12px 24px 24px; display: flex; flex-direction: column; gap: 8px; max-width: 880px; }
.post-grid { list-style: none; margin: 0; padding: 12px 24px 24px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.post-card { appearance: none; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 6px;
  padding: 14px 16px; border-radius: var(--radius); background: var(--main-filler); border: 2px solid transparent; }
.post-card:hover { border-color: var(--main-Foreground2); }
.post-grid .post-card { padding: 0 0 12px; overflow: hidden; }
.post-grid .post-card > :not(.post-thumb) { margin: 0 12px; }
.post-thumb { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--main-background); }
.post-card-title { font-weight: 600; font-size: 16px; }
.post-excerpt { color: var(--main-Foreground2); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.post-title { font-size: 18px; font-weight: 600; margin: 2px 0 4px; }

/* ---------- Stickers, menus, GIFs, dropdowns ---------- */
.sticker { width: 160px; height: 160px; object-fit: contain; display: block; margin: 4px 0; }
.sticker.small { width: 56px; height: 56px; margin: 0; }
.popover { position: absolute; z-index: 40; bottom: calc(100% + 8px); left: 0; background: var(--main-filler); border: 2px solid var(--main-Foreground2); border-radius: var(--radius); padding: 6px; }
.menu { display: flex; flex-direction: column; min-width: 160px; }
.menu-item { appearance: none; border: 0; background: none; font: inherit; color: var(--main-Foreground3); text-align: left; padding: 8px 12px; border-radius: calc(var(--radius) - 4px); cursor: pointer; }
.menu-item:hover, .menu-item:focus-visible { background: var(--main-background); }
.sticker-picker { display: grid; grid-template-columns: repeat(4, 76px); gap: 4px; max-height: 340px; overflow-y: auto; }
.sticker-btn, .gif-btn { appearance: none; border: 0; background: none; padding: 4px; border-radius: calc(var(--radius) - 4px); cursor: pointer; }
.sticker-btn:hover, .gif-btn:hover, .sticker-btn:focus-visible, .gif-btn:focus-visible { background: var(--main-background); }
.sticker-btn img { width: 68px; height: 68px; object-fit: contain; display: block; }
.gif-picker { width: min(420px, 86vw); display: flex; flex-direction: column; gap: 8px; padding: 10px; }
.gif-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; max-height: 320px; overflow-y: auto; }
.gif-btn img { width: 100%; height: 90px; object-fit: cover; display: block; border-radius: 6px; }
.tiny { font-size: 11px; margin: 0; }
.bot-select { max-width: 360px; }
.bot-multi { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: var(--radius); background: var(--main-filler); max-width: 420px; }
.textarea { resize: vertical; min-height: 90px; font-family: inherit; line-height: 1.5; }
.rules-text { padding: 14px 16px; border-radius: var(--radius); background: var(--main-background); max-height: 50vh; overflow-y: auto; white-space: pre-wrap; }

/* ---------- Stage and soundboard ---------- */
.stage-speaker { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.stage-speaker .call-tile { width: 100%; }
.audience { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.audience-member { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius); background: var(--main-filler); flex-wrap: wrap; }
.audience-member > span:not(.avatar) { flex: 1; min-width: 80px; }
.soundboard { display: grid; grid-template-columns: repeat(2, minmax(120px, 1fr)); gap: 4px; min-width: 260px; max-height: 300px; overflow-y: auto; }
.sound-btn { appearance: none; border: 1px solid var(--main-Foreground2); background: var(--main-background); color: var(--main-Foreground3); font: inherit; font-size: 13px;
  padding: 8px 10px; border-radius: calc(var(--radius) - 4px); cursor: pointer; display: flex; gap: 8px; align-items: center; }
.sound-btn:hover { border-color: var(--main-Foreground3); }
@media (max-width: 760px) { .tag-filter, .post-list, .post-grid { padding-left: 10px; padding-right: 10px; } .post-grid { grid-template-columns: repeat(2, 1fr); } }

/* =================== Motion ===================
   Quick and calm: things fade and settle a few pixels into place. Nothing loops, bounces or
   blocks input. Everything here is switched off by the system "reduce motion" setting and
   by Your settings > Accessibility > Reduce motion. */
:root {
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-in-out: cubic-bezier(.4, 0, .2, 1);
  --t-fast: 120ms;
  --t-base: 180ms;
  --t-slow: 240ms;
}
@keyframes hc-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes hc-pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes hc-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes hc-drop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes hc-slide-left { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes hc-toast { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes hc-bump { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes hc-flash { 0%, 30% { background: rgba(255, 255, 255, .14); } 100% { background: transparent; } }

/* Things that appear */
.overlay { animation: hc-fade var(--t-base) var(--ease-out); }
.modal { animation: hc-pop var(--t-base) var(--ease-out); }
.popover, .picker, .suggest { animation: hc-pop var(--t-fast) var(--ease-out); transform-origin: bottom left; }
.toast { animation: hc-toast var(--t-base) var(--ease-out); }
.side-panel { animation: hc-slide-left var(--t-base) var(--ease-out); }
.status-bar, .ring { animation: hc-drop var(--t-base) var(--ease-out); }
.scrim { animation: hc-fade var(--t-base) var(--ease-out); }
.msg.new { animation: hc-rise var(--t-base) var(--ease-out); }
.day.new-line { animation: hc-fade var(--t-slow) var(--ease-out); }
.call-tile, .audience-member, .voice-people li, .lobby-person { animation: hc-pop var(--t-base) var(--ease-out); }
.embed, .attachments, .poll, .components, .reactions .reaction { animation: hc-fade var(--t-base) var(--ease-out); }
.empty, .intro, .admin-body > *, .settings-body > * { animation: hc-fade var(--t-base) var(--ease-out); }
.post-card, .result, .event, .stat { animation: hc-rise var(--t-base) var(--ease-out) both; }
.msg.flash { animation: hc-flash 2.4s var(--ease-out); }

/* Things that change */
.nav-item, .tile, .row, .result, .post-card, .menu-item, .suggest-item, .picker-emoji, .sticker-btn, .gif-btn, .sound-btn, .tag-chip,
.reaction, .poll-option, .swatch, .att-file, .embed, .admin-table tr, .msg, .you-btn, .link, .msg-author {
  transition: background-color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out),
    color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out), opacity var(--t-fast) var(--ease-out);
}
.msg-actions, .msg-hover-time { transition: opacity var(--t-fast) var(--ease-out); }
.reaction:active, .poll-option:active:not(:disabled), .tile:active, .sticker-btn:active, .gif-btn:active, .sound-btn:active, .picker-emoji:active { transform: scale(.95); }
.reaction.mine { animation: hc-bump var(--t-base) var(--ease-out); }
.post-card:hover, .result:hover { transform: translateY(-1px); }
.tile:hover:not(.active) { transform: translateY(-1px); }
.poll-bar, .progress-fill, .bar { transition: width var(--t-slow) var(--ease-out), height var(--t-slow) var(--ease-out); }
.presence { transition: background-color var(--t-base) var(--ease-out), border-color var(--t-base) var(--ease-out); }
.avatar, .call-tile { transition: box-shadow var(--t-fast) var(--ease-out); }
.nav-wrap { transition: transform var(--t-base) var(--ease-out); }
.pip, .tile-count { animation: hc-pop var(--t-base) var(--ease-out); }
.ds-btn { transition: background-color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out), opacity var(--t-fast) var(--ease-out); }
.ds-btn:active:not(:disabled) { transform: scale(.97); }
.spoiler { transition: background-color var(--t-base) var(--ease-out), color var(--t-base) var(--ease-out); }

/* Off when asked */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
.version-bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-width: 560px; }
.version-bars li { display: grid; grid-template-columns: 110px 1fr 40px; gap: 12px; align-items: center; }
.version-bars .progress-track { max-width: none; }
.progress-track.wide { max-width: none; display: block; }
.compact-select { padding-top: 6px; padding-bottom: 6px; min-width: 86px; }
.update-ring { background: var(--main-Foreground3); }

/* =================== Desktop app title bar ===================
   Only present in the desktop app (html.has-titlebar). The bar is the window's drag area; buttons inside it opt out.
   env(titlebar-area-*) comes from the system and marks where its window buttons are not, so text never runs
   under the minimise/maximise/close buttons (Windows, Linux) or the traffic lights (macOS). */
:root { --titlebar-h: 0px; }
html.has-titlebar { --titlebar-h: 36px; }
html.has-titlebar #root { padding-top: var(--titlebar-h); }
.titlebar {
  position: fixed; inset: 0 0 auto 0; height: var(--titlebar-h); z-index: 70;
  display: flex; align-items: center; gap: 10px;
  padding-left: max(10px, calc(env(titlebar-area-x, 0px) + 6px));
  padding-right: calc(100vw - env(titlebar-area-x, 0px) - env(titlebar-area-width, 100vw) + 10px);
  background: var(--main-filler); color: var(--main-Foreground3); border-bottom: 1px solid var(--main-background);
  font-size: 12px; -webkit-app-region: drag; user-select: none; -webkit-user-select: none;
  transition: color var(--t-base) var(--ease-out);
}
.titlebar.blurred { color: var(--main-Foreground2); }
.titlebar.blurred .tb-logo, .titlebar.blurred .tb-update { opacity: .6; }
.tb-logo { width: 15px; height: auto; flex: none; transition: opacity var(--t-base) var(--ease-out); }
.tb-brand { font-weight: 600; flex: none; }
.tb-where { color: var(--main-Foreground2); min-width: 0; max-width: 32vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-spacer { flex: 1; min-width: 8px; }
.tb-btn {
  -webkit-app-region: no-drag; appearance: none; border: 0; background: transparent; color: inherit; font: inherit; font-size: 12px;
  height: 26px; padding: 0 10px; border-radius: 6px; display: inline-flex; align-items: center; gap: 10px; flex: none;
  transition: background-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.tb-btn:hover, .tb-btn:focus-visible { background: var(--main-background); }
.tb-btn:focus-visible { outline: 2px solid var(--main-Foreground3); outline-offset: -2px; }
.tb-menu { font-weight: 500; }
.tb-search { width: min(420px, 38vw); justify-content: space-between; background: var(--main-background); color: var(--main-Foreground2); border: 1px solid transparent; }
.tb-search:hover { border-color: var(--main-Foreground2); color: var(--main-Foreground3); }
.tb-search kbd { font-family: inherit; font-size: 11px; opacity: .8; }
.tb-update { background: var(--main-Foreground3); color: var(--main-filler); font-weight: 600; }
.tb-update:hover, .tb-update:focus-visible { background: var(--main-Foreground3); opacity: .9; }
/* Things that cover the screen start below the bar, so the window can still be dragged */
html.has-titlebar .overlay, html.has-titlebar .scrim { top: var(--titlebar-h); }
@media (max-width: 1100px) { html.has-titlebar .side-panel { top: var(--titlebar-h); padding-top: 0; } }
@media (max-width: 760px) { html.has-titlebar .nav-wrap { top: var(--titlebar-h); padding-top: 0; } }
@media (max-width: 640px) { .tb-brand, .tb-where { display: none; } .tb-search { width: auto; } .tb-search span { display: none; } }

/* =================== Devices and sounds =================== */
.mic-test { display: flex; align-items: center; gap: 12px; }
.meter { flex: 1; height: 8px; border-radius: 999px; background: var(--main-background); overflow: hidden; max-width: 320px; }
.meter-fill { display: block; height: 100%; width: 0; background: var(--main-Foreground3); border-radius: inherit; transition: width 60ms linear; }
.cam-preview { width: 100%; max-width: 360px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius); background: #000; transform: scaleX(-1); }
.volume-row { display: flex; align-items: center; gap: 12px; }
.range { flex: 1; max-width: 320px; accent-color: var(--main-Foreground3); }
.sound-list { display: flex; flex-wrap: wrap; gap: 6px; }
.sound-try { appearance: none; font: inherit; font-size: 12px; color: var(--main-Foreground3); background: var(--main-background); border: 1px solid transparent;
  border-radius: 999px; padding: 4px 12px; cursor: pointer; transition: border-color var(--t-fast) var(--ease-out); }
.sound-try:hover, .sound-try:focus-visible { border-color: var(--main-Foreground2); }
.ringing-out { display: flex; align-items: center; gap: 12px; padding: 8px 12px; color: var(--main-Foreground2); font-size: 13px; animation: hc-fade var(--t-base) var(--ease-out); }
/* Settings tabs: one line each; the bar scrolls sideways when there are more than fit. */
.settings-tabs { overflow-x: auto; scrollbar-width: thin; }
.settings-tabs [role="tab"] { white-space: nowrap; flex: none; }

/* =================== Landing page (/ when signed out, and /download) =================== */
.landing { height: 100%; overflow-y: auto; background: var(--main-background); color: var(--main-Foreground3); scroll-behavior: smooth; }
.landing a:not(.ds-btn) { color: inherit; text-underline-offset: 3px; }
.landing a:focus-visible, .landing .link:focus-visible { outline: 2px solid var(--main-Foreground3); outline-offset: 3px; border-radius: 4px; }
.lp-top, .lp-hero, .lp-features, .lp-downloads, .lp-foot { max-width: 1180px; margin-left: auto; margin-right: auto; padding-left: 32px; padding-right: 32px; }
.lp-top { display: flex; align-items: center; justify-content: space-between; padding-top: 22px; padding-bottom: 22px; }
.lp-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; text-decoration: none; }
.lp-brand img { width: 20px; height: auto; }
.lp-top-links { display: flex; align-items: center; gap: 22px; font-size: 14px; }
.lp-top-links a { color: var(--main-Foreground2); text-decoration: none; }
.lp-top-links a:hover { color: var(--main-Foreground3); }

.lp-hero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 56px; align-items: center; margin-top: 40px; }
.lp-hero h1 { font-size: clamp(2.4rem, 4.4vw, 3.5rem); line-height: 1.08; letter-spacing: -0.03em; font-weight: 600; margin: 0; max-width: 17ch; text-wrap: balance; }
.lp-lede { font-size: 1.125rem; line-height: 1.6; color: var(--main-Foreground2); max-width: 34rem; margin: 20px 0 30px; }
.lp-cta { display: flex; flex-wrap: wrap; gap: 12px; }
.lp-download { text-decoration: none; }
.lp-fine { font-size: 13px; line-height: 1.6; color: var(--main-Foreground2); margin: 14px 0 0; max-width: 34rem; }

/* The live preview: the app in miniature */
.lp-preview { display: grid; grid-template-columns: 52px 168px minmax(0, 1fr); height: 390px; border-radius: 18px; overflow: hidden;
  background: var(--main-background); border: 1px solid rgba(255, 255, 255, .08); box-shadow: 0 36px 80px rgba(0, 0, 0, .38); font-size: 12px; user-select: none; }
.lp-rail { background: var(--main-filler); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 0; border-right: 1px solid rgba(255, 255, 255, .05); }
.lp-rail-logo, .lp-rail-item { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; font-weight: 600; font-size: 11px; }
.lp-rail-logo { background: var(--main-Foreground3); }
.lp-rail-logo img { width: 15px; filter: invert(1); }
.lp-rail-item { background: var(--main-background); }
.lp-rail-item.add { background: none; border: 1.5px dashed var(--main-Foreground2); color: var(--main-Foreground2); }
.lp-side { background: var(--main-filler); padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.lp-side-head { font-weight: 600; font-size: 13px; padding: 2px 8px 10px; }
.lp-chan { color: var(--main-Foreground2); padding: 5px 8px; border-radius: 7px; }
.lp-chan.active { background: var(--main-background); color: var(--main-Foreground3); }
.lp-chan.voice { margin-top: 10px; }
.lp-voice { display: flex; flex-direction: column; gap: 6px; padding: 2px 8px 0 16px; color: var(--main-Foreground2); }
.lp-voice span { display: flex; align-items: center; gap: 7px; }
.lp-preview .avatar.speaking { animation: lp-speak 1.8s var(--ease-in-out) infinite; }
@keyframes lp-speak { 0%, 100% { box-shadow: 0 0 0 2px rgba(255, 255, 255, .95); } 50% { box-shadow: 0 0 0 4px rgba(255, 255, 255, .22); } }
.lp-main { display: flex; flex-direction: column; gap: 14px; padding: 12px 18px 14px; min-width: 0; }
.lp-main-head { font-weight: 600; font-size: 13px; padding-bottom: 10px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.lp-msg { display: flex; gap: 10px; align-items: flex-start; }
.lp-msg-meta { display: flex; gap: 8px; align-items: baseline; }
.lp-msg-meta strong { font-size: 12.5px; }
.lp-msg-meta span { font-size: 10.5px; color: var(--main-Foreground2); }
.lp-msg p { margin: 2px 0 0; line-height: 1.45; }
.lp-composer { margin-top: auto; background: var(--main-filler); border-radius: 10px; padding: 9px 12px; color: var(--main-Foreground2); }

.lp-features, .lp-downloads { margin-top: 112px; }
.lp-features h2, .lp-downloads h2 { font-size: clamp(1.6rem, 2.6vw, 2rem); font-weight: 600; letter-spacing: -0.02em; margin: 0 0 28px; }
.lp-features dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px 56px; margin: 0; }
.lp-features dl > div { padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, .12); }
.lp-features dt { font-weight: 600; font-size: 16px; }
.lp-features dd { margin: 6px 0 0; color: var(--main-Foreground2); line-height: 1.6; max-width: 34rem; }

.lp-dl-list { list-style: none; margin: 0; padding: 0; }
.lp-dl-list li { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.5fr) minmax(0, 2fr) auto; gap: 16px; align-items: center;
  padding: 16px 0; border-top: 1px solid rgba(255, 255, 255, .12); }
.lp-dl-list li:last-child { border-bottom: 1px solid rgba(255, 255, 255, .12); }
.lp-dl-name { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lp-dl-name span { font-size: 11px; padding: 2px 9px; border-radius: 999px; background: var(--main-filler); color: var(--main-Foreground3); }
.lp-dl-meta, .lp-dl-how { font-size: 13px; color: var(--main-Foreground2); line-height: 1.5; }
.lp-dl-list .ds-btn { text-decoration: none; justify-self: end; }

.lp-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 120px; padding-top: 26px; padding-bottom: 40px;
  border-top: 1px solid rgba(255, 255, 255, .12); color: var(--main-Foreground2); font-size: 13px; }

@media (max-width: 900px) {
  .lp-hero { grid-template-columns: minmax(0, 1fr); gap: 40px; margin-top: 16px; }
  .lp-features dl { grid-template-columns: minmax(0, 1fr); }
  .lp-dl-list li { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; }
  .lp-dl-meta, .lp-dl-how { grid-column: 1; }
  .lp-dl-list .ds-btn { grid-column: 2; grid-row: 1 / span 3; }
  .lp-features, .lp-downloads { margin-top: 80px; }
}
@media (max-width: 560px) {
  .lp-top, .lp-hero, .lp-features, .lp-downloads, .lp-foot { padding-left: 20px; padding-right: 20px; }
  .lp-preview { grid-template-columns: 44px minmax(0, 1fr); height: 330px; }
  .lp-side { display: none; }
  .lp-top-links a { display: none; }
}

/* =================== Right-click menu =================== */
.ctx-menu { position: fixed; z-index: 120; min-width: 210px; max-width: 280px; padding: 6px; border-radius: 10px;
  background: var(--main-filler); border: 1px solid rgba(255, 255, 255, .1); box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
  animation: hc-pop var(--t-fast) var(--ease-out); transform-origin: top left; font-size: 13px; }
.ctx-item { appearance: none; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; text-align: left;
  font: inherit; color: var(--main-Foreground3); background: none; border: 0; border-radius: 6px; padding: 7px 10px; cursor: pointer; }
.ctx-item:hover, .ctx-item:focus-visible { background: var(--main-background); outline: none; }
.ctx-item:disabled { color: var(--main-Foreground2); opacity: .55; cursor: default; background: none; }
.ctx-item.danger { color: #ff6b6b; }
.ctx-item.danger:hover, .ctx-item.danger:focus-visible { background: #c20000; color: #fff; }
.ctx-hint { color: var(--main-Foreground2); font-size: 11px; }
.ctx-sep { height: 1px; background: rgba(255, 255, 255, .1); margin: 5px 4px; }
.ctx-reactions { display: flex; justify-content: space-between; gap: 2px; padding: 2px 2px 4px; }
.ctx-reactions button { appearance: none; border: 0; background: var(--main-background); border-radius: 8px; width: 32px; height: 32px; font-size: 17px; cursor: pointer;
  transition: transform var(--t-fast) var(--ease-out), background-color var(--t-fast) var(--ease-out); }
.ctx-reactions button:hover, .ctx-reactions button:focus-visible { transform: scale(1.12); outline: 2px solid var(--main-Foreground3); outline-offset: -2px; }
.ctx-check { width: 16px; height: 16px; border-radius: 4px; border: 2px solid var(--main-Foreground2); flex: none; position: relative; }
.ctx-check.on { background: var(--main-Foreground3); border-color: var(--main-Foreground3); }
.ctx-check.on::after { content: ""; position: absolute; left: 4px; top: 0; width: 4px; height: 8px; border: solid var(--main-filler); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.ctx-slider { padding: 6px 10px 8px; }
.ctx-slider-head { display: flex; justify-content: space-between; margin-bottom: 6px; }
.ctx-slider input { width: 100%; accent-color: var(--main-Foreground3); }

/* Desktop app: update popup */
.update-notes { padding: 12px 14px; border-radius: var(--radius); background: var(--main-background); }
.update-notes p { margin: 4px 0 0; white-space: pre-wrap; color: var(--main-Foreground2); }
.update-progress { height: 6px; border-radius: 999px; background: var(--main-background); overflow: hidden; }
.update-progress span { display: block; height: 100%; background: var(--main-Foreground3); border-radius: inherit; transition: width var(--t-base) var(--ease-out); }

/* =================== End-to-end encryption =================== */
.e2ee-pill { appearance: none; display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border-radius: 999px; cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 600; color: var(--main-Foreground2); background: transparent; border: 1px solid var(--main-Foreground2);
  transition: border-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out), background-color var(--t-fast) var(--ease-out); }
.e2ee-pill:hover, .e2ee-pill:focus-visible { color: var(--main-Foreground3); border-color: var(--main-Foreground3); }
.e2ee-pill:focus-visible { outline: 2px solid var(--main-Foreground3); outline-offset: 2px; }
.e2ee-pill.on { color: var(--main-filler); background: var(--main-Foreground3); border-color: var(--main-Foreground3); }
/* A small padlock drawn in CSS: shackle (border) over a body (box) */
.e2ee-lock { position: relative; width: 10px; height: 8px; margin-top: 4px; border-radius: 2px; background: currentColor; flex: none; }
.e2ee-lock::before { content: ""; position: absolute; left: 1.5px; top: -5px; width: 7px; height: 7px; box-sizing: border-box; border: 1.6px solid currentColor; border-bottom: 0; border-radius: 4px 4px 0 0; }
.e2ee-pill:not(.on) .e2ee-lock::before { left: 3.5px; transform: rotate(14deg); transform-origin: bottom left; }
.msg-system { display: flex; justify-content: center; align-items: baseline; gap: 10px; text-align: center; padding: 10px 24px; margin: 6px 0;
  color: var(--main-Foreground2); font-size: 13px; }
.msg-system span:first-child { max-width: 60ch; }
.e2ee-note { color: var(--main-Foreground2); font-style: italic; }
.e2ee-points { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; color: var(--main-Foreground2); font-size: 13px; line-height: 1.5; }
.e2ee-code { display: flex; flex-direction: column; gap: 3px; padding: 8px 12px; border-radius: var(--radius); background: var(--main-background); }
.e2ee-code code, .row-sub code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; letter-spacing: .02em; word-break: break-word; }
.profile-security { padding: 0 20px 18px; }
.profile-security summary { cursor: pointer; font-weight: 600; font-size: 13px; padding: 8px 0; }
