*, *::before, *::after { box-sizing: border-box; }
html {
  --text-scale: 1;
  --avatar-opacity: 1;
  --bubble-opacity: 1;
  --pill-color: #1a1d26;
  --pill-opacity: 0.55;
  --bubble-peer-text: #1a1d26;
  --avatar-bg: #7939f2;
  --wallpaper-color: #d0e7f5;
  --wallpaper-gradient: none;
  --wallpaper-pattern-ink: #6b8fa8;
  --wallpaper-tile: 280px;
  --wallpaper-pattern: none;
  /* Frosted glass: chrome floats light; sheets need more milk so chat doesn't grey them out. */
  --glass-bg: rgba(255, 255, 255, 0.48);
  --glass-panel-bg: rgba(255, 255, 255, 0.78);
  --glass-chip-bg: rgba(255, 255, 255, 0.62);
  --glass-tools-bg: rgba(255, 255, 255, 0.88);
  --glass-menu-mix: 86%;
  --glass-blur: 16px;
  --glass-border: 1px solid rgba(216, 216, 220, 0.75);
  --glass-dim: rgba(15, 23, 42, 0.14);
  --chrome-icon-scale: 1;
  --chrome-icon-btn: calc(36px * var(--chrome-icon-scale));
  --chrome-icon-svg: calc(22px * var(--chrome-icon-scale));
}
html, body {
  height: 100%;
  min-height: 100%;
  min-height: 100dvh;
  margin: 0;
  /* Same paint as chat wallpaper: keyboard overlay must never flash sidebar blue/white. */
  background-color: var(--wallpaper-color, #d0e7f5);
  background-image: var(--wallpaper-gradient, none);
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center top;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  /* Stop iOS rubber-band / back-swipe from exposing the blank WebView edge. */
  overscroll-behavior-x: none;
}
html.shell-booting,
html.shell-booting body {
  background-color: #1e325c !important;
  background-image: none !important;
}
html[data-wallpaper="custom"],
html[data-wallpaper="custom"] body {
  background-image: var(--wallpaper-image-mobile, none);
  background-size: var(--wallpaper-size-mobile, cover);
  background-position: var(--wallpaper-pos-mobile, center center);
}
html[data-wallpaper="space"],
html[data-wallpaper="space"] body {
  background-image:
    var(--wallpaper-image-mobile, none),
    var(--wallpaper-space-gradient, linear-gradient(135deg, #fff2ff 0%, #eed5f0 25%, #dbcdf8 50%, #81d1f5 75%, #72cbf1 100%));
  background-size: var(--wallpaper-size-mobile, cover), cover;
  background-position: var(--wallpaper-pos-mobile, center center), center;
  background-repeat: no-repeat, no-repeat;
}
/* Pattern mode is solid color by default; doodle overlay stays off unless --wallpaper-pattern is set. */
html[data-wallpaper="pattern"] body::before {
  content: none;
  display: none;
}
html[data-wallpaper="custom"] body::before {
  content: none;
  display: none;
}
body {
  font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: #3f4350;
}
@supports (min-height: -webkit-fill-available) {
  html, body { min-height: -webkit-fill-available; }
}
:root,
html[data-theme="blue"] {
  --rail: #15284a;
  --sidebar: #1e325c;
  --sidebar-head: #192a4d;
  --accent: #1c58d9;
  --accent-hover: #154ab8;
  --accent-soft: #eef3ff;
  --accent-mark: #8eb4ff;
  --action: #1c58d9;
  --action-hover: #154ab8;
  --action-soft: #eef3ff;
  --action-text: #ffffff;
  --mention-bg: #e8f1ff;
  --login-glow: rgba(87, 158, 255, .35);
  --login-bg: #14264d;
  --text-strong: #1e325c;
}
html[data-theme="purple"] {
  --rail: #2a1550;
  --sidebar: #3b1d6e;
  --sidebar-head: #31185c;
  --accent: #7939f2;
  --accent-hover: #6529d6;
  --accent-soft: #f3ecff;
  --accent-mark: #c4a6ff;
  --mention-bg: #efe6ff;
  --login-glow: rgba(168, 120, 255, .35);
  --login-bg: #241242;
  --text-strong: #3b1d6e;
}
html[data-theme="green"] {
  --rail: #14352c;
  --sidebar: #1b4d3e;
  --sidebar-head: #174436;
  --accent: #3db887;
  --accent-hover: #2f9a6f;
  --accent-soft: #eaf8f1;
  --accent-mark: #8fd9b8;
  --mention-bg: #e4f7ee;
  --login-glow: rgba(61, 184, 135, .35);
  --login-bg: #102820;
  --text-strong: #1b4d3e;
}
html[data-theme="red"] {
  --rail: #4a1a1c;
  --sidebar: #6a2428;
  --sidebar-head: #5a1f22;
  --accent: #d24b4e;
  --accent-hover: #b53c3f;
  --accent-soft: #fdeeee;
  --accent-mark: #f0a0a2;
  --mention-bg: #fce4e5;
  --login-glow: rgba(210, 75, 78, .32);
  --login-bg: #351012;
  --text-strong: #6a2428;
}
html[data-theme="orange"] {
  --rail: #4a2f0f;
  --sidebar: #6b4514;
  --sidebar-head: #5a3a11;
  --accent: #e0941a;
  --accent-hover: #c07d12;
  --accent-soft: #fff5e6;
  --accent-mark: #f0c27a;
  --mention-bg: #ffefd6;
  --login-glow: rgba(224, 148, 26, .32);
  --login-bg: #35210a;
  --text-strong: #6b4514;
}
html[data-theme="navy"] {
  --rail: #0f1a2e;
  --sidebar: #16233d;
  --sidebar-head: #121c33;
  --accent: #3a6fd8;
  --accent-hover: #2f5cb8;
  --accent-soft: #eaf0fb;
  --accent-mark: #8eade8;
  --mention-bg: #e4ecfa;
  --login-glow: rgba(58, 111, 216, .32);
  --login-bg: #0c1424;
  --text-strong: #16233d;
}
button, input, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
[hidden] { display: none !important; }
/* Visually hidden but still "shown" so mobile WebViews open the picker on .click(). */
.file-input-hidden {
  position: fixed;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

/* Kept in DOM for paintAllTeamMarks ids; never shown as a wallpaper splash. */
.boot {
  display: none !important;
}
.team-mark {
  width: 42px; height: 42px; border-radius: 8px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 18px;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.25);
  overflow: hidden;
  flex-shrink: 0;
}
.team-mark img {
  width: 100%; height: 100%; object-fit: contain; display: block;
}
.team-mark.has-logo {
  background: transparent;
  box-shadow: none;
  border-radius: 50%;
}
.team-mark.is-clickable { cursor: pointer; }
.settings-logo-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin: 4px 0 16px;
}
.settings-logo-wrap {
  position: relative;
  width: 56px;
  height: 56px;
}
.settings-logo-wrap .team-mark {
  width: 56px;
  height: 56px;
  font-size: 22px;
}
.settings-logo-wrap .settings-avatar-edit {
  position: absolute;
  right: -4px;
  bottom: -4px;
}
.settings-logo-wrap .avatar-clear {
  position: absolute;
  top: -6px;
  right: -6px;
}
.settings-logo-hint {
  margin: 0;
  font-size: 13px;
  color: var(--muted, #6b7280);
}
.logo-crop-editor {
  width: 100%;
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.logo-crop-editor.hidden { display: none !important; }
.logo-crop-stage-wrap {
  display: flex;
  justify-content: center;
  padding: 14px;
  border: 1px solid #e8eaef;
  border-radius: 14px;
  background: #f3f5f8;
}
.logo-crop-frame {
  position: relative;
  width: 168px;
  height: 168px;
  overflow: hidden;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0,0,0,.08), 0 8px 24px rgba(16,24,40,.12);
  background: #233259;
  touch-action: none;
  cursor: grab;
  user-select: none;
}
.logo-crop-frame.is-dragging { cursor: grabbing; }
.logo-crop-img {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-repeat: no-repeat;
  background-size: 100%;
  background-position: 50% 50%;
  pointer-events: none;
}
.logo-crop-zoom-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 48px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  color: #5c6270;
}
.logo-crop-zoom-row input[type="range"] { width: 100%; }
.logo-crop-zoom-row span { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; color: #1a1d26; }
.logo-crop-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
  color: #8b8e98;
}
.logo-crop-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  min-height: 100%;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(900px 420px at 50% -10%, var(--login-glow), transparent 55%), var(--login-bg);
  padding: 24px;
  box-sizing: border-box;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.login-screen > .auth-card { margin: auto; }
/* Soft keyboard open: top-align + bottom pad so the focused field can scroll above the IME. */
.login-screen.is-kb-open {
  align-items: flex-start;
  justify-content: center;
  padding-bottom: calc(24px + var(--kb-field-inset, 0px) + env(safe-area-inset-bottom, 0px));
}
@media (max-width: 600px) {
  .login-screen { padding: 56px 16px 16px; }
  .login-screen.is-kb-open {
    padding-top: max(12px, env(safe-area-inset-top, 0px));
    padding-bottom: calc(16px + var(--kb-field-inset, 0px) + env(safe-area-inset-bottom, 0px));
  }
  .auth-card { padding: 20px 20px 16px; border-radius: 12px; }
  .auth-card .logo { width: 56px; height: 56px; margin-bottom: 8px; }
  .auth-card h1 { font-size: 22px; }
  .auth-card label { margin: 10px 0 4px; }
  .auth-card .btn.wide { margin-top: 8px; }
  .auth-card .auth-switch { margin-top: 12px; }
}
/* Generic mobile forms (settings panels, sheets): room under the keyboard. */
html.kb-field-open #admin-screen:not(.hidden),
html.kb-field-open #profile-screen:not(.hidden),
html.kb-field-open #feature-screen:not(.hidden),
html.kb-field-open #rhs:not(.hidden) {
  padding-bottom: max(12px, var(--kb-field-inset, 0px));
  scroll-padding-bottom: calc(16px + var(--kb-field-inset, 0px));
}
.login-lang {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .12);
  backdrop-filter: blur(6px);
}
.login-lang-btn {
  min-width: 40px;
  padding: 6px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, .72);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
}
.login-lang-btn:hover { color: #fff; }
.login-lang-btn.is-active {
  background: rgba(255, 255, 255, .92);
  color: #1a2333;
}
.auth-card {
  width: 420px; max-width: 100%; background: #fff; border-radius: 8px;
  box-shadow: 0 16px 48px rgba(0,0,0,.28); padding: 28px 28px 20px;
}
.logo {
  width: 72px; height: 72px; border-radius: 50%; background: transparent;
  display: grid; place-items: center; margin: 0 auto 12px;
  overflow: visible;
}
.logo img {
  width: 100%; height: 100%; object-fit: contain; display: block;
}
.auth-card .logo { overflow: hidden; }
.auth-card .logo img { object-fit: cover; border-radius: 50%; }
.auth-card h1 { text-align: center; margin: 0; font-size: 26px; }
.lede, .hint { text-align: center; color: #6b7080; font-size: 14px; }
.lede { margin: 6px 0 0; }
.hint { margin: 16px 0 0; line-height: 1.4; }
.auth-switch { text-align: center; margin: 16px 0 0; }
.auth-switch a { color: var(--accent); font-weight: 700; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }
.auth-setup-toggle {
  display: block;
  width: 100%;
  margin: 10px 0 0;
  padding: 0;
  border: 0;
  background: none;
  color: #8b8e98;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}
.auth-setup-toggle:hover { color: #6b7080; text-decoration: underline; }
#form-setup { position: relative; }
.setup-edit-btn {
  position: absolute;
  top: 14px;
  right: 16px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.setup-edit-btn:hover { text-decoration: underline; }
.setup-edit-btn:disabled {
  color: #8b8e98;
  cursor: default;
  text-decoration: none;
}
#form-setup.is-locked input,
#form-setup.is-locked select {
  background: #f0f2f6;
  color: #6b7080;
  pointer-events: none;
}
#form-setup.is-locked #setup-db-test,
#form-setup.is-locked #setup-submit {
  pointer-events: none;
  opacity: .55;
}
#setup-step-db .req { color: #d24b4e; font-weight: 700; }
.setup-db-status {
  min-height: 1.2em;
  margin: 10px 0 0;
  font-size: 13px;
  font-weight: 600;
}
.setup-db-status.is-ok { color: #1f8a4c; }
.setup-db-status.is-fail { color: #d24b4e; }
#setup-db-test {
  margin-top: 12px;
  background: #fff;
  border: 1px solid #d7dbe3;
  color: #3a3f4b;
}
#setup-db-test:hover { background: #f0f2f6; }
#setup-submit:disabled {
  opacity: .55;
  cursor: not-allowed;
}
label { display: block; font-size: 13px; font-weight: 700; margin: 12px 0 6px; }
input[type="text"], input[type="password"], input[type="url"], input:not([type]) {
  width: 100%; border: 1px solid #d0d4dc; border-radius: 4px; padding: 10px 12px;
  box-sizing: border-box;
  background: #fff;
  color: inherit;
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
}
.form-error { color: #d24b4e; min-height: 1.2em; font-size: 13px; margin-top: 8px; }
.btn {
  border: 1px solid #d0d4dc; background: #fff; border-radius: 4px; padding: 8px 12px; font-weight: 700;
}
.btn.primary { background: var(--action); color: var(--action-text, #fff); border-color: transparent; }
.btn.primary:hover { background: var(--action-hover); }
.btn.ghost {
  background: transparent;
  border: 1px solid #d0d4dc;
  color: var(--text-strong, #1a1d26);
}
.btn.ghost:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent, #1c58d9) 6%, transparent);
}
.btn.danger { color: #d24b4e; border-color: #f0c8c8; background: #fdeeee; }
.btn.danger:hover { background: #fbdada; }
.btn.wide { width: 100%; margin-top: 12px; padding: 11px; }
.btn:disabled, .send:disabled { opacity: .65; cursor: default; }
#login #form-login .login-submit.btn {
  display: block;
  width: auto;
  min-width: 160px;
  margin: 10px auto 0;
  padding: 6px 28px;
  background: transparent;
  color: #8b8e98;
  border: 1px solid transparent;
  border-radius: 8px;
  box-shadow: none;
  filter: none;
  opacity: 1;
  transition: border-color .15s, color .15s;
}
#login #form-login .login-submit.btn.is-ready { color: var(--accent, #1c58d9); }
#login #form-login .login-submit.btn:hover,
#login #form-login .login-submit.btn:focus-visible {
  background: transparent;
  border-color: var(--accent, #1c58d9);
  outline: none;
}
#form-login .form-error { min-height: 0; margin-top: 6px; }
#login-fields {
  width: 100%;
  max-width: 260px;
  margin: 0 auto;
}
.password-wrap { position: relative; width: 100%; }
.password-wrap input { padding-right: 40px; }
.password-toggle {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: none;
  color: #8b8e98;
  cursor: pointer;
}
.password-toggle:hover,
.password-toggle:focus-visible { color: var(--accent, #1c58d9); outline: none; }
/* Hidden (default): slashed eye. Revealed: open eye. */
.password-toggle .eye-open { display: none; }
.password-toggle .eye-closed { display: block; }
.password-toggle[aria-pressed="true"] .eye-open { display: block; }
.password-toggle[aria-pressed="true"] .eye-closed { display: none; }
#form-login .auth-switch { margin: 6px 0 0; }
#form-login .auth-setup-toggle { margin-top: 12px; }
/* Register submit: idle = white + gray label; ready = primary action + white text. */
#register-submit.btn.primary {
  background: #fff;
  color: #8b8e98;
  border-color: transparent;
  box-shadow: none;
  filter: none;
  opacity: 1;
}
#register-submit.btn.primary:hover:not(.is-ready),
#register-submit.btn.primary:focus-visible:not(.is-ready) {
  background: #fff;
  color: #8b8e98;
  border-color: transparent;
  box-shadow: none;
  filter: none;
}
#register-submit.btn.primary.is-ready {
  background: var(--action, #1c58d9);
  color: #fff;
  border-color: transparent;
}
#register-submit.btn.primary.is-ready:hover {
  background: var(--action-hover, #154ab8);
  color: #fff;
  border-color: transparent;
}
/* Waiting-screen login: inactive until admin approves. */
#register-waiting-login.btn.primary {
  background: #fff;
  color: #8b8e98;
  border-color: transparent;
  box-shadow: none;
  filter: none;
  opacity: 1;
  cursor: default;
}
#register-waiting-login.btn.primary:hover:not(.is-ready),
#register-waiting-login.btn.primary:focus-visible:not(.is-ready) {
  background: #fff;
  color: #8b8e98;
  border-color: transparent;
  box-shadow: none;
  filter: none;
}
#register-waiting-login.btn.primary.is-ready {
  background: var(--action, #1c58d9);
  color: #fff;
  border-color: transparent;
  cursor: pointer;
}
#register-waiting-login.btn.primary.is-ready:hover {
  background: var(--action-hover, #154ab8);
  color: #fff;
  border-color: transparent;
}

.app {
  position: relative;
  z-index: 1;
  height: 100%; display: flex; min-height: 0; width: 100%; max-width: 100%; overflow: hidden;
}
.team-rail {
  width: 68px; background: var(--rail); display: flex; flex-direction: column; align-items: center;
  padding: 12px 0; min-height: 0; position: relative; z-index: 4; gap: 10px;
}
.team-rail .team-mark.rail-home {
  appearance: none; border: 0; padding: 0; margin: 0; cursor: pointer;
  background: transparent; flex: none;
}
.team-rail .team-mark.rail-home:focus-visible {
  outline: 2px solid rgba(255,255,255,.75); outline-offset: 2px;
}
.rail-tools {
  display: flex; flex-direction: column; align-items: center; gap: 6px; flex: none;
}
.team-rail .rail-me-bar {
  margin-top: auto;
  margin-bottom: 4px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.team-rail .rail-me-bar .me-button {
  width: 44px;
  height: 44px;
}
.team-rail .rail-me-bar .me-button .avatar {
  width: 36px; height: 36px; min-width: 36px; min-height: 36px;
  max-width: 36px; max-height: 36px; flex: 0 0 36px; font-size: 13px;
}
/* Menu opens to the right of the bottom-left avatar. */
.team-rail .rail-me-bar .user-menu {
  left: calc(100% + 10px);
  right: auto;
  bottom: 0;
  top: auto;
  max-height: min(70vh, 520px);
}
.rail-btn {
  width: 44px; height: 44px; border: 0; border-radius: 12px; padding: 0;
  display: grid; place-items: center; cursor: pointer;
  background: transparent; color: rgba(255,255,255,.72);
  -webkit-tap-highlight-color: transparent;
}
.rail-btn svg { display: block; }
.rail-btn:hover { color: #fff; background: rgba(255,255,255,.1); }
.rail-btn:focus-visible { outline: 2px solid rgba(255,255,255,.75); outline-offset: 2px; }
.rail-btn.is-active {
  color: #fff; background: rgba(255,255,255,.16);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.app.rail-feature-open .thread,
.app.rail-feature-open .composer-wrap,
.app.rail-feature-open .channel-header { display: none !important; }
/* Tasks reuses the glass channel header (#/name · Задачи + search),
   with the same inset under the header as the dialogue overlay. */
.app.rail-feature-open.feature-chrome-open .channel-header {
  display: flex !important;
  padding-left: 12px;
}
.app.rail-feature-open.feature-chrome-open #feature-screen {
  padding-top: calc(var(--chat-scroll-top, 76px) + 12px);
  padding-left: 12px;
  padding-right: 12px;
}
/* Mail list: bottom composer stays hidden. It appears only while a letter window is open. */
.app.rail-feature-open.mail-mode:not(.mail-dialog-open) .composer-wrap {
  display: none !important;
}
.app.rail-feature-open.mail-mode.mail-dialog-open .composer-wrap {
  display: block !important;
  z-index: 8;
}
.app.rail-feature-open.mail-mode.feature-chrome-open #feature-screen {
  top: 0;
  left: 18px !important;
  right: 18px !important;
  width: auto !important;
  bottom: 8px;
  height: auto;
  padding-top: calc(var(--chat-scroll-top, 76px) + 12px);
  padding-bottom: 4px;
  padding-left: 0 !important;
  padding-right: 0 !important;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  overflow: hidden;
  box-sizing: border-box;
}
.app.rail-feature-open #feature-screen { display: flex; }
.app.dialogue-open #feature-screen,
.app.notif-center-open #feature-screen { display: none !important; }

/* Settings must fully cover chat chrome (same idea as rail features). */
.app.settings-open .thread,
.app.settings-open .composer-wrap,
.app.settings-open .channel-header,
.app.settings-open.rail-feature-open .channel-header,
.app.settings-open.feature-chrome-open .channel-header,
.app.settings-open.mail-mode .channel-header,
.app.settings-open .pinned-banner,
.app.settings-open .banner,
.app.settings-open #feature-screen,
.app.settings-open #mail-dialog-overlay { display: none !important; }
.feature-screen {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 5;
  background: transparent;
  justify-content: center;
  overflow: auto;
  padding: calc(28px + env(safe-area-inset-top, 0px)) 20px calc(40px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}
.feature-card {
  width: min(720px, 100%);
  background: var(--glass-tools-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  border: var(--glass-border);
  border-radius: 16px;
  padding: 16px 28px 32px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
  align-self: flex-start;
}
.feature-back {
  display: grid; place-items: center;
  width: 40px; height: 40px; margin: 0 0 4px -10px; padding: 0;
  color: #1a1d26; border-radius: 10px; flex: none;
}
.feature-back:hover { background: #f2f2f2; }
.feature-back svg { display: block; }
.feature-card h1 { margin: 0 0 8px; font-size: calc(24px * var(--text-scale, 1)); color: #1a1d26; }
.feature-lead { margin: 0 0 22px; color: #6b7080; font-size: calc(15px * var(--text-scale, 1)); line-height: 1.45; }
.feature-toolbar {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  margin: 0 0 16px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.feature-toolbar::-webkit-scrollbar { display: none; }
.feature-toolbar.hidden { display: none !important; }
.feature-tab {
  appearance: none; border: 1px solid #e4e7ec; background: #fff; color: #5c6270;
  border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer;
  flex: 0 0 auto;
  white-space: nowrap;
}
.feature-tab:hover { background: #f3f5f8; }
.feature-tab.is-active {
  color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, #fff);
  background: var(--accent-soft);
}
.feature-body { min-height: 160px; }
.feature-empty {
  border: 1px dashed #d0d4dc; border-radius: 12px; padding: 36px 20px;
  text-align: center; color: #8b8e98; font-size: calc(14px * var(--text-scale, 1));
  background: #fafbfc;
}
.notes-list { display: flex; flex-direction: column; gap: 8px; }
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; align-items: start; padding: 4px 2px 8px; }
.feature-group-title {
  margin: 10px 0 4px; padding: 2px 2px;
  font-size: calc(12px * var(--text-scale, 1)); font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; color: #8b8e98;
}
.feature-group-title:first-child { margin-top: 0; }
button.feature-group-title {
  appearance: none; border: 0; background: transparent; width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  cursor: pointer; font: inherit; text-align: left;
  font-size: calc(12px * var(--text-scale, 1)); font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; color: #8b8e98;
}
.feature-group-label {
  min-width: 0; flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.feature-group-chevron {
  width: 22px; height: 22px; flex: none; position: relative;
}
.feature-group-chevron::before {
  content: "";
  position: absolute; left: 5px; top: 5px;
  width: 10px; height: 10px;
  border-right: 2.5px solid #6b7080; border-bottom: 2.5px solid #6b7080;
  transform: rotate(45deg); transition: transform .15s ease;
}
button.feature-group-title.is-collapsed .feature-group-chevron::before {
  top: 7px; transform: rotate(-45deg);
}
.polls-group-items {
  display: flex; flex-direction: column; gap: 12px;
}
.notes-item {
  appearance: none; width: 100%; border: 1px solid #e8eaef; background: #fff;
  border-radius: 12px; padding: 14px 16px; text-align: left; cursor: pointer;
  font: inherit; color: inherit; display: flex; flex-direction: column; gap: 4px;
}
.notes-item:hover { border-color: #d5d9e2; background: #fafbfc; }
.notes-item-title {
  font-weight: 700; font-size: calc(15px * var(--text-scale, 1)); color: #1a1d26;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.notes-item-preview {
  color: #6b7080; font-size: calc(13px * var(--text-scale, 1)); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.notes-item-meta {
  color: #9aa0ab; font-size: calc(12px * var(--text-scale, 1)); margin-top: 2px;
}
.notes-editor { display: flex; flex-direction: column; gap: 10px; }
.notes-editor-title {
  width: 100%; box-sizing: border-box; border: 1px solid #e4e7ec; border-radius: 10px;
  padding: 10px 12px; font: inherit; font-size: calc(16px * var(--text-scale, 1)); font-weight: 700;
  color: #1a1d26; background: #fff;
}
.notes-editor-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.notes-editor-body {
  width: 100%; box-sizing: border-box; border: 1px solid #e4e7ec; border-radius: 10px;
  padding: 12px; font: inherit; font-size: calc(15px * var(--text-scale, 1)); line-height: 1.45;
  color: #1a1d26; background: #fff; min-height: 220px; resize: vertical;
}
.notes-editor-rich {
  resize: none; overflow: auto; white-space: pre-wrap; word-break: break-word;
  outline: none; min-height: 240px;
}
.notes-editor-rich.is-empty:before {
  content: attr(data-placeholder);
  color: #9aa0ab; pointer-events: none;
}
.notes-inline-img-wrap {
  display: block; position: relative; margin: 8px 0; max-width: 100%;
  width: fit-content;
}
.notes-inline-img {
  display: block; max-width: 100%; max-height: 360px; width: auto; height: auto;
  border-radius: 10px; border: 1px solid #e8eaef; background: #fafbfc;
  object-fit: contain;
}
.notes-inline-img-remove {
  appearance: none; position: absolute; top: 6px; right: 6px;
  width: 28px; height: 28px; border-radius: 8px; border: 0;
  background: rgba(26, 29, 38, .72); color: #fff;
  font: inherit; font-size: 18px; line-height: 1; cursor: pointer;
  display: grid; place-items: center; padding: 0;
}
.notes-inline-img-remove:hover { background: #b42318; }
.notes-editor-title:focus, .notes-editor-body:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, #fff); outline-offset: 1px;
  border-color: color-mix(in srgb, var(--accent) 40%, #d0d4dc);
}
.notes-editor-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.notes-btn {
  appearance: none; border: 1px solid #e4e7ec; background: #fff; color: #5c6270;
  border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer;
}
.notes-btn:hover { background: #f3f5f8; color: #1f2430; }
.notes-btn.primary {
  background: var(--action); border-color: var(--action); color: var(--action-text, #fff);
}
.notes-btn.primary:hover { filter: brightness(1.05); color: var(--action-text, #fff); }
.notes-btn.danger { color: #b42318; border-color: #f3c4c0; }
.notes-btn.danger:hover { background: #fef3f2; }
.notes-btn:disabled { opacity: .55; cursor: default; }
.tasks-composer {
  display: flex; gap: 8px; align-items: center; margin-bottom: 14px;
  justify-content: flex-end;
}
.tasks-composer input {
  flex: 1; min-width: 0; box-sizing: border-box; border: 1px solid #e4e7ec; border-radius: 10px;
  padding: 10px 12px; font: inherit; font-size: calc(15px * var(--text-scale, 1));
  color: #1a1d26; background: #fff;
}
.tasks-composer input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, #fff); outline-offset: 1px;
  border-color: color-mix(in srgb, var(--accent) 40%, #d0d4dc);
}
.tasks-panel { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tasks-list { display: flex; flex-direction: column; gap: 6px; }
.tasks-date-filters {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.tasks-date-stack { display: flex; flex-direction: column; gap: 10px; }
.tasks-date-card {
  margin: 0;
  padding: 14px;
  border: 1px solid #ebebeb;
  border-radius: 10px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  background: #fff;
}
.tasks-date-disclose {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
  box-sizing: border-box;
}
.tasks-date-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tasks-date-text strong {
  font-size: calc(16px * var(--text-scale, 1));
  color: var(--text-strong, #1a1d26);
}
.tasks-date-hint {
  font-size: calc(13px * var(--text-scale, 1));
  color: #6b7080;
  line-height: 1.35;
}
.tasks-date-disclose .chevron {
  flex: none;
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  opacity: .55;
}
.tasks-date-disclose[aria-expanded="false"] .chevron { transform: rotate(-45deg); }
.tasks-date-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f0f1f4;
}
.tasks-date-panel.hidden { display: none !important; }
.calendar-nav {
  display: flex; align-items: center; gap: 8px; margin: 0 0 12px; flex-wrap: wrap;
}
.calendar-nav-title {
  flex: 1; min-width: 0; text-align: center;
  font-size: calc(16px * var(--text-scale, 1)); font-weight: 700; color: #1a1d26;
}
.calendar-nav-btn {
  appearance: none; border: 1px solid #e8eaef; background: #fff; color: #5c6270;
  width: 36px; height: 36px; border-radius: 10px; cursor: pointer;
  display: grid; place-items: center; padding: 0; font: inherit;
}
.calendar-nav-btn:hover { background: #f3f5f8; color: #1a1d26; }
.calendar-today-btn {
  appearance: none; border: 1px solid #e8eaef; background: #fff; color: #5c6270;
  border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer;
}
.calendar-today-btn:hover { background: #f3f5f8; }
.calendar-sheet {
  background: #fff; border: 1px solid #e8eaef; border-radius: 18px;
  overflow: hidden; margin: 0 0 16px;
}
.calendar-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  margin: 0;
}
.calendar-day {
  appearance: none; border: 0; border-right: 1px solid #ebebeb; border-bottom: 1px solid #ebebeb;
  background: #fff; color: #1a1d26; cursor: pointer; font: inherit;
  min-height: 78px; padding: 10px 4px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border-radius: 0; box-sizing: border-box;
}
.calendar-day.is-first-week { min-height: 96px; padding-top: 8px; gap: 6px; }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-grid .calendar-day:nth-last-child(-n+7) { border-bottom: 0; }
.calendar-day:hover { background: #fafbfc; }
.calendar-day.is-holiday {
  background: color-mix(in srgb, var(--cal-holiday, #e88a8a) 18%, #fff);
}
.calendar-day.is-holiday:hover {
  background: color-mix(in srgb, var(--cal-holiday, #e88a8a) 26%, #fff);
}
.calendar-dow {
  font-size: 12px; font-weight: 600; color: #8b8e98;
  letter-spacing: .02em; line-height: 1; text-transform: none;
}
.calendar-dow.is-sunday { color: var(--cal-weekend, #d15d4d); }
.calendar-day.is-sunday { color: var(--cal-weekend, #d15d4d); }
.calendar-day.is-sunday .calendar-day-num { color: var(--cal-weekend, #d15d4d); }
.calendar-day.is-outside { color: #c0c4cc; }
.calendar-day.is-outside .calendar-day-num { color: #c0c4cc; font-weight: 500; }
.calendar-day.is-selected .calendar-day-num,
.calendar-day.is-today.is-selected .calendar-day-num,
.calendar-day.is-sunday.is-selected .calendar-day-num {
  background: var(--action, #1c58d9); color: var(--action-text, #fff);
}
.calendar-day.is-today:not(.is-selected) .calendar-day-num {
  box-shadow: inset 0 0 0 1.5px var(--action, #1c58d9); color: var(--action, #1c58d9);
}
.calendar-day.is-sunday.is-today:not(.is-selected) .calendar-day-num {
  box-shadow: inset 0 0 0 1.5px var(--cal-weekend, #d15d4d);
  color: var(--cal-weekend, #d15d4d);
}
.calendar-day-num {
  width: 28px; height: 28px; border-radius: 999px;
  display: grid; place-items: center;
  font-size: 14px; font-weight: 600; line-height: 1; color: inherit;
}
.calendar-day-num.calendar-day-label {
  width: auto; min-width: 0; height: auto; padding: 2px 0;
  border-radius: 0; font-size: 12px; font-weight: 500;
  background: transparent !important; box-shadow: none !important; color: #c0c4cc !important;
}
.calendar-day-label {
  font-size: 11px; font-weight: 500; color: inherit; white-space: nowrap;
}
.calendar-day-marks {
  display: flex; flex-direction: column; gap: 3px; min-height: 8px;
  align-items: stretch; justify-content: flex-end;
  width: 70%; max-width: 36px; margin-top: auto;
}
.calendar-mark {
  display: block; height: 4px; border-radius: 999px; background: var(--cal-task, #9ec9ea);
}
.calendar-mark.is-alert { background: var(--cal-holiday, #e88a8a); }
.calendar-mark.is-done { background: #12b76a; }
.settings-card select.cal-week-select,
.cal-week-select {
  flex: 0 1 auto;
  width: auto !important;
  min-width: 140px;
  max-width: 180px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #d8dbe3;
  border-radius: 10px;
  background: #fff;
  color: var(--text-strong);
  font: inherit;
  font-size: calc(13px * var(--text-scale, 1));
  font-weight: 600;
  line-height: 1.3;
  box-sizing: border-box;
  cursor: pointer;
}
.cal-pref-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px;
  column-gap: 8px;
  margin-top: 12px;
  align-items: center;
}
.cal-pref-line > .cal-pref-row {
  margin-top: 0;
  min-width: 0;
}
.cal-pref-line > .for-all-toggle {
  width: 64px;
  align-self: center;
  justify-self: center;
  display: grid;
  place-items: center;
  margin: 0 !important;
  padding: 0;
  min-height: 26px;
}
.cal-pref-line-top > .for-all-toggle {
  align-self: start;
  margin-top: 18px !important;
}
.cal-pref-row {
  display: flex; align-items: center; gap: 12px;
  margin: 12px 0 0; padding: 12px 14px;
  border: 1px solid #e8eaef; border-radius: 14px; background: #fff;
  box-sizing: border-box;
}
.cal-pref-row-stack {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}
.cal-pref-row-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.cal-pref-text {
  flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px;
}
.cal-pref-text strong {
  font-size: calc(14px * var(--text-scale, 1)); font-weight: 700; color: #1a1d26;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-pref-text span {
  font-size: calc(12px * var(--text-scale, 1)); color: #6b7080; line-height: 1.35;
}
.settings-card button.cal-color,
button.cal-color {
  -webkit-appearance: none; appearance: none;
  flex: 0 0 36px; width: 36px !important; min-width: 36px; max-width: 36px;
  height: 36px; padding: 3px; margin: 0;
  border: 1px solid #d8dbe3; border-radius: 10px;
  background:
    linear-gradient(var(--cal-swatch, #d15d4d), var(--cal-swatch, #d15d4d)) content-box,
    #fff;
  cursor: pointer; box-sizing: border-box;
}
button.cal-color.is-editing {
  border-color: var(--accent, #1c58d9);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent, #1c58d9) 28%, transparent);
}
.cal-custom-holidays {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid #eef0f4;
}
.settings-card .cal-custom-holidays > strong,
.cal-custom-holidays > strong {
  margin: 0;
  font-size: calc(13px * var(--text-scale, 1));
  font-weight: 700;
  color: #1a1d26;
}
.settings-card input.cal-holiday-country-search,
.cal-holiday-country-search {
  flex: 1 1 auto;
  width: 100% !important;
  max-width: none;
  min-width: 0;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #d8dbe3;
  border-radius: 10px;
  background: #fff;
  color: var(--text-strong);
  font: inherit;
  font-size: calc(13px * var(--text-scale, 1));
  font-weight: 400;
  line-height: 1.3;
  box-sizing: border-box;
}
.cal-holiday-country-add {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.cal-holiday-country-picker {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 220px;
}
.cal-holiday-country-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  max-height: 220px;
  overflow: auto;
  margin: 0;
  padding: 4px;
  border: 1px solid #e0e3ea;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(26, 29, 38, 0.12);
  box-sizing: border-box;
}
.cal-holiday-country-list.hidden { display: none !important; }
.cal-holiday-country-option {
  display: block;
  width: 100%;
  appearance: none;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #1a1d26;
  text-align: left;
  padding: 8px 10px;
  margin: 0;
  font: inherit;
  font-size: calc(13px * var(--text-scale, 1));
  font-weight: 400;
  cursor: pointer;
  box-sizing: border-box;
}
.cal-holiday-country-option:hover,
.cal-holiday-country-option.is-active {
  background: color-mix(in srgb, var(--accent, #1c58d9) 10%, #fff);
}
.cal-holiday-country-empty {
  padding: 10px;
  color: #6b7080;
  font-size: calc(12px * var(--text-scale, 1));
}
.cal-holiday-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
}
.cal-holiday-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 5px 10px;
  border: 1px solid #d8dbe3;
  border-radius: 999px;
  background: transparent;
  color: #1a1d26;
  font: inherit;
  font-size: calc(12px * var(--text-scale, 1));
  font-weight: 600;
  line-height: 1.2;
  box-sizing: border-box;
}
.cal-holiday-chip-remove {
  appearance: none;
  border: 0;
  background: transparent;
  color: #6b7080;
  margin: 0 0 0 2px;
  padding: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  opacity: .85;
}
.cal-holiday-chip-remove:hover {
  opacity: 1;
  background: rgba(0,0,0,.06);
}
.settings-card .cal-holidays-input,
.cal-holidays-input {
  width: 100%; min-height: 72px; resize: vertical;
  border: 1px solid #e8eaef; border-radius: 12px; padding: 10px 12px;
  font: inherit; font-size: calc(13px * var(--text-scale, 1));
  box-sizing: border-box; display: block; margin-top: 0;
}
.cal-custom-holidays-hint {
  margin: 0;
  font-size: calc(12px * var(--text-scale, 1));
  color: #6b7080;
  line-height: 1.35;
}
.calendar-day-panel {
  border-top: 0; padding-top: 4px;
}
.calendar-day-heading {
  margin: 0 0 10px; font-size: calc(14px * var(--text-scale, 1)); font-weight: 700; color: #1a1d26;
}
@media (max-width: 800px) {
  .calendar-day { min-height: 58px; padding: 6px 2px 8px; }
  .calendar-day.is-first-week { min-height: 74px; }
  .calendar-day-num { width: 26px; height: 26px; font-size: 13px; }
  .calendar-dow { font-size: 11px; }
}
.tasks-item {
  display: flex; flex-direction: column; gap: 4px;
  border: 1px solid #e8eaef; background: #fff; border-radius: 12px; padding: 10px 12px;
}
.tasks-item.is-done { opacity: .85; }
.tasks-item.is-overdue { border-color: #f3c4c0; }
.tasks-head {
  display: flex; align-items: flex-start; gap: 8px;
}
.tasks-title {
  flex: 1; min-width: 0;
  font-size: calc(15px * var(--text-scale, 1)); line-height: 1.4;
  color: #1a1d26; word-break: break-word;
}
.tasks-item.is-done .tasks-title { color: #8b8e98; }
.tasks-card-tools {
  display: flex; align-items: center; gap: 2px; flex: none; margin-top: -2px;
}
.tasks-icon-btn {
  appearance: none; border: 0; background: transparent; color: #9aa0ab;
  width: 32px; height: 32px; border-radius: 8px; padding: 0;
  display: grid; place-items: center; cursor: pointer;
}
.tasks-icon-btn svg { width: 18px; height: 18px; display: block; }
.tasks-icon-btn:hover { color: #1f2430; background: #f3f5f8; }
.tasks-icon-btn:disabled { opacity: .5; cursor: default; }
.tasks-mid {
  display: flex; align-items: flex-start; gap: 10px;
}
.tasks-content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.tasks-status {
  flex: none; width: 32px; height: 32px; border-radius: 10px; margin-top: 2px;
  display: grid; place-items: center;
}
.tasks-status.is-ok { color: #12b76a; background: #ecfdf3; }
.tasks-status.is-overdue { color: #f04438; background: #fef3f2; }
.tasks-desc {
  color: #6b7080; font-size: calc(13px * var(--text-scale, 1)); line-height: 1.35;
  white-space: pre-wrap; word-break: break-word;
}
.tasks-desc-btn, .tasks-due-btn {
  appearance: none; border: 0; background: transparent; padding: 0; margin: 0;
  text-align: left; cursor: pointer; font: inherit; color: inherit; width: 100%;
}
.tasks-due {
  color: #9aa0ab; font-size: calc(12px * var(--text-scale, 1)); margin-top: 2px;
}
.tasks-due.is-overdue { color: #b42318; }
.tasks-goals {
  margin: 2px 0 0; padding: 0; list-style: none;
  display: flex; flex-direction: column; gap: 4px;
}
.tasks-goal-item {
  display: flex; align-items: flex-start; gap: 6px;
  color: #5c6270; font-size: calc(13px * var(--text-scale, 1)); line-height: 1.35;
}
.tasks-goal-item.is-done .tasks-goal-text { text-decoration: line-through; color: #9aa0ab; }
.tasks-goal-toggle {
  appearance: none; border: 1.5px solid #c5cad3; background: #fff; color: transparent;
  width: 18px; height: 18px; border-radius: 5px; padding: 0; margin-top: 1px; flex: none;
  display: grid; place-items: center; cursor: pointer;
}
.tasks-goal-toggle svg { width: 12px; height: 12px; display: block; }
.tasks-goal-toggle[aria-pressed="true"] {
  background: #12b76a; border-color: #12b76a; color: #fff;
}
.tasks-goal-toggle:hover:not(:disabled) { border-color: var(--accent); }
.tasks-goal-toggle:disabled {
  cursor: default; opacity: .7;
}
.tasks-goal-text {
  appearance: none; border: 0; background: transparent; padding: 0; margin: 0;
  text-align: left; cursor: pointer; font: inherit; color: inherit; flex: 1; min-width: 0;
}
.tasks-goal-text.is-readonly { cursor: default; }
.tasks-goal-assignee { color: #9aa0ab; }
.tasks-del {
  appearance: none; border: 0; background: transparent; color: #9aa0ab;
  width: 28px; height: 28px; border-radius: 8px; cursor: pointer; flex: none;
  display: grid; place-items: center; padding: 0; margin-top: -2px;
}
.tasks-del:hover { color: #b42318; background: #fef3f2; }
.msg.task-only .msg-bubble {
  max-width: min(92%, 440px);
  padding: 0;
  background: transparent;
  box-shadow: none;
  color: #1a1d26;
  position: relative;
}
.msg.mine.task-only .msg-bubble {
  background: transparent;
  color: #1a1d26;
}
.msg.task-only .msg-body.msg-task-body {
  white-space: normal;
  margin: 0;
  padding: 0;
}
.msg.task-only .msg-time,
.msg.task-only .msg-edited,
.msg.mine.task-only .msg-time,
.msg.mine.task-only .msg-edited {
  color: #fff;
  font-size: calc(11px * var(--text-scale, 1));
  font-weight: 500;
}
.msg.task-only .msg-receipt {
  --receipt-muted: rgba(255, 255, 255, .4);
  --receipt-blue: #fff;
}
.chat-task-mount { width: 100%; display: block; line-height: 0; }
.chat-task-card.tasks-item {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  background: #fff;
  border: 1px solid #e8eaef;
  border-radius: 14px;
  padding: 12px 14px 14px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
  line-height: normal;
}
.chat-task-card.is-gone,
.chat-task-loading {
  border: 1px solid #e8eaef;
  border-radius: 14px;
  background: #fff;
  padding: 14px 16px;
  color: #9aa0ab;
  font-size: calc(14px * var(--text-scale, 1));
  line-height: normal;
}
.msg.poll-only .msg-bubble {
  width: 100%;
  max-width: min(92%, 560px);
  padding: 0;
  background: transparent;
  box-shadow: none;
  color: #1a1d26;
  position: relative;
}
.msg.mine.poll-only .msg-bubble {
  background: transparent;
  color: #1a1d26;
}
.msg.poll-only .msg-body.msg-poll-body {
  white-space: normal;
  margin: 0;
  padding: 0;
}
.msg.poll-only .msg-time,
.msg.poll-only .msg-edited,
.msg.mine.poll-only .msg-time,
.msg.mine.poll-only .msg-edited {
  color: #fff;
  font-size: calc(11px * var(--text-scale, 1));
  font-weight: 500;
}
.msg.poll-only .msg-receipt {
  --receipt-muted: rgba(255, 255, 255, .4);
  --receipt-blue: #fff;
}
.chat-poll-mount { width: 100%; display: block; line-height: 0; }
.chat-poll-card.poll-card {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
  padding-bottom: 14px;
  line-height: normal;
}
.chat-poll-card.is-gone,
.chat-poll-loading {
  border: 1px solid #e8eaef;
  border-radius: 14px;
  background: #fff;
  padding: 14px 16px;
  color: #9aa0ab;
  font-size: calc(14px * var(--text-scale, 1));
  line-height: normal;
}
.dialog-body textarea {
  width: 100%; box-sizing: border-box; min-height: 96px; resize: vertical;
  border: 1px solid #d0d4dc; border-radius: 8px; padding: 10px 12px;
  font: inherit; font-size: 14px; color: #1a1d26; background: #fff;
}
.dialog-body textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, #fff); outline-offset: 1px;
}
.dialog-body input[type="date"],
.dialog-body input[type="time"],
.dialog-body select {
  width: 100%; box-sizing: border-box; border: 1px solid #d0d4dc; border-radius: 8px;
  padding: 10px 12px; font: inherit; font-size: 14px; color: #1a1d26; background: #fff;
  min-height: 42px; color-scheme: light; accent-color: #c5cad3;
  -webkit-appearance: none; appearance: none;
}
.dialog-body input[type="date"]:focus,
.dialog-body input[type="time"]:focus {
  outline: 2px solid #d8dbe2; outline-offset: 1px;
  border-color: #c5cad3;
}
.dialog-body select:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, #fff); outline-offset: 1px;
  border-color: color-mix(in srgb, var(--accent) 40%, #d0d4dc);
}
.dialog-section-label {
  display: block; margin: 16px 0 4px; font-size: 13px; font-weight: 700; color: #1a1d26;
}
.task-goals-editor {
  display: flex; flex-direction: column; gap: 8px; margin: 4px 0 8px;
  position: relative;
}
.tasks-inline-editor {
  display: flex; flex-direction: column; gap: 4px;
  border: 1px solid #e8eaef; background: #fff; border-radius: 12px; padding: 14px 16px;
  margin-bottom: 12px;
}
.tasks-inline-editor-head {
  font-size: calc(16px * var(--text-scale, 1)); font-weight: 700; color: #1a1d26;
  margin-bottom: 4px;
}
.task-editor-form.is-inline label {
  display: block; margin: 12px 0 4px; font-size: 13px; font-weight: 700;
}
.task-editor-form.is-inline label:first-child { margin-top: 0; }
.task-editor-form.is-inline input[type="text"],
.task-editor-form.is-inline input[type="date"],
.task-editor-form.is-inline input[type="time"],
.task-editor-form.is-inline select {
  width: 100%; box-sizing: border-box;
}
.task-editor-form.is-inline .btn.wide { margin-top: 12px; }
.task-editor-form textarea.task-desc-input,
.task-editor-form.is-inline textarea.task-desc-input {
  width: 100%; box-sizing: border-box; border: 1px solid #e4e7ec; border-radius: 10px;
  padding: 10px 12px; margin: 8px 0 4px; font: inherit;
  font-size: calc(15px * var(--text-scale, 1)); color: #1a1d26; background: #fff;
  resize: vertical; font-weight: 400; min-height: 64px;
}
.task-editor-form textarea.task-desc-input:focus,
.task-editor-form.is-inline textarea.task-desc-input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, #fff); outline-offset: 1px;
  border-color: color-mix(in srgb, var(--accent) 40%, #d0d4dc);
}
.task-goal-row {
  display: flex; flex-direction: column; gap: 6px;
  border: 1px solid #e8eaef; border-radius: 10px; padding: 10px;
  background: #fff;
  transition: box-shadow .15s ease, transform .15s ease, opacity .15s ease;
  will-change: transform;
}
.task-goal-row.is-dragging {
  position: fixed;
  z-index: 80;
  margin: 0;
  opacity: 1;
  pointer-events: none;
  background: #fff;
  box-shadow: 0 10px 28px rgba(26, 29, 38, 0.18);
  outline: 1px solid color-mix(in srgb, var(--accent, #1c58d9) 28%, #e4e7ec);
}
.task-goal-spacer {
  border-radius: 10px;
  box-sizing: border-box;
  border: 1.5px dashed color-mix(in srgb, var(--accent, #1c58d9) 45%, #d0d4dc);
  background: color-mix(in srgb, var(--accent, #1c58d9) 6%, #fff);
  flex: none;
}
.task-goal-row-top { display: flex; gap: 6px; align-items: center; }
.task-goal-field {
  position: relative; flex: 1; min-width: 0;
}
.task-goal-field input {
  width: 100%; box-sizing: border-box; padding-right: 40px;
}
.task-goal-drag {
  appearance: none; border: 0; background: transparent; color: #9aa0ab;
  width: 28px; height: 32px; border-radius: 8px; padding: 0; cursor: grab;
  display: grid; place-items: center; flex: none;
  touch-action: none; user-select: none;
}
.task-goal-drag:active { cursor: grabbing; }
.task-goal-drag svg { width: 16px; height: 16px; display: block; pointer-events: none; }
.task-goal-remove {
  appearance: none; border: 0; background: transparent; color: #9aa0ab;
  width: 32px; height: 32px; border-radius: 8px; cursor: pointer; flex: none;
  display: grid; place-items: center; padding: 0;
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  z-index: 1;
}
.task-goal-remove svg { width: 18px; height: 18px; display: block; }
.task-goal-remove:hover { color: #b42318; background: #fef3f2; }
.task-add-assignee,
.task-add-goal {
  appearance: none; border: 0; background: transparent; color: #6b7080;
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 2px;
  font: inherit; font-size: calc(14px * var(--text-scale, 1)); font-weight: 400;
  cursor: pointer; align-self: flex-start;
}
.task-add-assignee { margin-left: 34px; }
.task-add-assignee:hover,
.task-add-goal:hover { color: #1f2430; }
.task-add-assignee-ico,
.task-add-goal-ico {
  width: 20px; height: 20px; display: grid; place-items: center;
  font-size: 18px; line-height: 1; font-weight: 500;
}
.task-goal-assignee-chip {
  display: inline-flex; align-items: center; gap: 4px;
  align-self: flex-start; max-width: 100%; margin-left: 34px;
}
.task-goal-assignee-name {
  appearance: none; border: 0; background: color-mix(in srgb, var(--accent, #1c58d9) 10%, #fff);
  color: #1a1d26; border-radius: 8px; padding: 6px 10px;
  font: inherit; font-size: calc(13px * var(--text-scale, 1)); cursor: pointer;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.task-goal-assignee-clear {
  appearance: none; border: 0; background: transparent; color: #9aa0ab;
  width: 28px; height: 28px; border-radius: 8px; cursor: pointer;
  display: grid; place-items: center; padding: 0; font-size: 16px; line-height: 1;
}
.task-goal-assignee-clear:hover { color: #b42318; background: #fef3f2; }
.task-due-section {
  display: flex; flex-direction: column; gap: 0;
  margin: 10px 0 0;
  border: 1px solid #e8eaef;
  background: #fff;
  border-radius: 14px;
  padding: 10px 14px 12px;
  box-sizing: border-box;
}
.task-due-toggle,
.task-editor-form.is-inline label.task-due-toggle,
.dialog-body label.task-due-toggle {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  padding: 4px 0 8px;
  margin: 0 !important;
  font-weight: 400;
  font-size: calc(13px * var(--text-scale, 1));
  line-height: 1.25;
  color: #1a1d26;
  user-select: none;
  min-height: 34px;
  box-sizing: border-box;
  width: 100%;
}
.task-due-toggle-label {
  flex: 1; min-width: 0; font-weight: 400; color: #1f2430;
  line-height: 1.25; display: flex; align-items: center;
}
.task-due-toggle input[type="checkbox"] {
  position: absolute !important; opacity: 0 !important;
  width: 1px !important; height: 1px !important;
  margin: 0 !important; pointer-events: none;
}
.task-due-toggle .polls-toggle-ui {
  flex: 0 0 42px; width: 42px; height: 24px;
  margin-left: auto; align-self: center;
}
.task-due-toggle input:checked + .polls-toggle-ui {
  background: var(--accent, #1c58d9);
}
.task-due-toggle input:checked + .polls-toggle-ui::after {
  transform: translateX(18px);
}
.task-due-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0;
}
.task-due-fields.hidden { display: none !important; }
.due-picker { min-width: 0; width: 100%; }
.due-picker-trigger {
  appearance: none;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid #d0d4dc;
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  font-size: calc(14px * var(--text-scale, 1));
  line-height: 1.3;
  color: #1a1d26;
  background: #fff;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-align: left;
}
.due-picker-trigger.is-empty { color: #9aa0ab; }
.due-picker-trigger:hover { border-color: #c5cad3; }
.due-picker-trigger:focus {
  outline: 2px solid color-mix(in srgb, var(--action, #1c58d9) 28%, #d8dbe2);
  outline-offset: 1px;
  border-color: color-mix(in srgb, var(--action, #1c58d9) 35%, #c5cad3);
}
.due-picker-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.due-picker-ico {
  flex: none; width: 18px; height: 18px; color: #9aa0ab;
  display: grid; place-items: center;
}
.due-picker-ico svg { width: 18px; height: 18px; display: block; }
.due-popover {
  position: fixed;
  z-index: 120;
  background: #fff;
  border: 1px solid #e4e7ec;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(26, 29, 38, 0.16);
  padding: 10px;
  box-sizing: border-box;
}
.due-popover-date { width: min(292px, calc(100vw - 24px)); }
.due-popover-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 8px; padding: 0 2px;
}
.due-popover-title {
  font-size: 14px; font-weight: 700; color: #1a1d26; text-transform: capitalize;
  min-width: 0; flex: 1;
}
.due-popover-nav { display: flex; gap: 2px; flex: none; }
.due-popover-nav-btn {
  appearance: none; border: 0; background: transparent; color: #6b7080;
  width: 28px; height: 28px; border-radius: 8px; cursor: pointer;
  display: grid; place-items: center; font-size: 18px; line-height: 1; padding: 0;
}
.due-popover-nav-btn:hover { background: #f3f5f8; color: #1a1d26; }
.due-popover-dow {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 0; margin-bottom: 2px;
}
.due-popover-dow-cell {
  text-align: center; font-size: 11px; font-weight: 400; color: #9aa0ab;
  padding: 4px 0; text-transform: capitalize;
}
.due-popover-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 0;
  border: 0; background: transparent;
}
.due-popover-day {
  appearance: none; border: 0; background: transparent; color: #1a1d26;
  width: 100%; aspect-ratio: 1; border-radius: 8px; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 400; padding: 0;
  display: grid; place-items: center; box-shadow: none;
}
.due-popover-day.is-empty { cursor: default; pointer-events: none; }
.due-popover-day:not(.is-empty):hover { background: #f3f5f8; }
.due-popover-day.is-selected {
  background: var(--action, #1c58d9);
  color: var(--action-text, #fff);
  font-weight: 400;
}
.due-popover-time { width: min(168px, calc(100vw - 24px)); padding: 8px; }
.due-popover-time-cols {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  max-height: 220px;
}
.due-popover-time-col {
  overflow: auto; max-height: 220px;
  border: 0; border-radius: 8px;
  background: #f7f8fa;
  scrollbar-width: thin;
}
.due-popover-time-item {
  appearance: none; border: 0; background: transparent; color: #1a1d26;
  width: 100%; padding: 8px 0; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 400;
  display: grid; place-items: center;
}
.due-popover-time-item:hover { background: #eef0f4; }
.due-popover-time-item.is-selected {
  background: var(--action, #1c58d9);
  color: var(--action-text, #fff);
  font-weight: 400;
}
.polls-list { display: flex; flex-direction: column; gap: 12px; }
.poll-card {
  border: 1px solid #e8eaef; background: #fff; border-radius: 12px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.poll-card-head {
  display: flex; align-items: flex-start; gap: 10px;
}
.poll-card-q {
  flex: 1; min-width: 0;
  font-weight: 700; font-size: calc(16px * var(--text-scale, 1)); color: #1a1d26; line-height: 1.35;
}
.poll-card-tools {
  display: flex; align-items: center; gap: 2px; flex: none; margin-top: -2px;
}
.poll-card-icon-btn {
  appearance: none; border: 0; background: transparent; color: #9aa0ab;
  width: 32px; height: 32px; border-radius: 8px; padding: 0;
  display: grid; place-items: center; cursor: pointer;
}
.poll-card-icon-btn svg { width: 18px; height: 18px; display: block; }
.poll-card-icon-btn:hover { color: #1f2430; background: #f3f5f8; }
.poll-card-icon-btn:disabled { opacity: .5; cursor: default; }
.poll-card-desc {
  color: #6b7080; font-size: calc(13px * var(--text-scale, 1)); line-height: 1.35;
  white-space: pre-wrap; word-break: break-word; margin-top: -2px;
}
.poll-card-meta { color: #9aa0ab; font-size: calc(12px * var(--text-scale, 1)); }
.poll-card-foot {
  color: #9aa0ab;
  font-size: calc(12px * var(--text-scale, 1));
  margin-top: 2px;
}
.poll-options { display: flex; flex-direction: column; gap: 6px; }
.poll-option {
  appearance: none; width: 100%; border: 1px solid #e4e7ec; background: #fff; color: #1a1d26;
  border-radius: 10px; padding: 10px 12px; text-align: left; cursor: pointer; font: inherit;
  position: relative; overflow: hidden;
}
.poll-option:hover { border-color: #d5d9e2; background: #fafbfc; }
.poll-option.is-mine {
  border-color: color-mix(in srgb, var(--accent) 45%, #fff);
  background: var(--accent-soft);
}
.poll-option.is-correct { border-color: #12b76a; }
.poll-option.is-wrong { border-color: #f04438; }
.poll-option:disabled { cursor: default; }
.poll-option-fill {
  position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--accent) 14%, #fff);
  pointer-events: none;
}
.poll-option-row {
  position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 10px; align-items: center;
}
.poll-option-label { min-width: 0; word-break: break-word; }
.poll-option-correct-mark { color: #12b76a; font-weight: 700; }
.poll-option-pct { flex: none; color: #6b7080; font-size: 13px; font-weight: 600; }
.poll-option-wrap { display: flex; flex-direction: column; gap: 4px; }
.poll-option-voters {
  padding: 0 4px 2px;
  color: #9aa0ab;
  font-size: calc(12px * var(--text-scale, 1));
  line-height: 1.35;
  word-break: break-word;
}
.poll-card-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.polls-composer { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.polls-composer.hidden { display: none !important; }
.polls-block {
  border: 1px solid #e8eaef; background: #fff; border-radius: 14px;
  padding: 12px 14px; display: flex; flex-direction: column; gap: 10px;
}
.polls-block-title {
  font-size: calc(14px * var(--text-scale, 1)); font-weight: 700; color: #1f2430;
}
.polls-composer input,
.polls-composer textarea.polls-desc-input {
  width: 100%; box-sizing: border-box; border: 1px solid #e4e7ec; border-radius: 10px;
  padding: 10px 12px; font: inherit; font-size: calc(15px * var(--text-scale, 1));
  color: #1a1d26; background: #fff; resize: vertical; font-weight: 400;
}
.polls-composer input:focus,
.polls-composer textarea.polls-desc-input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, #fff); outline-offset: 1px;
  border-color: color-mix(in srgb, var(--accent) 40%, #d0d4dc);
}
.polls-channel-picker-wrap {
  display: flex; flex-direction: column; gap: 4px;
  padding: 2px 0 6px; border-bottom: 1px solid #eceef2; margin-bottom: 0;
}
.polls-channel-picker { position: relative; }
.polls-channel-search {
  width: 100%; box-sizing: border-box; border: 1px solid #e4e7ec; border-radius: 10px;
  padding: 7px 10px; font: inherit; font-size: calc(13px * var(--text-scale, 1));
  color: #1a1d26; background: #fff; line-height: 1.25;
}
.polls-channel-search:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, #fff); outline-offset: 1px;
  border-color: color-mix(in srgb, var(--accent) 40%, #d0d4dc);
}
.polls-channel-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 40;
  max-height: 220px; overflow: auto; margin: 0; padding: 4px;
  border: 1px solid #e0e3ea; border-radius: 12px; background: #fff;
  box-shadow: 0 10px 28px rgba(26, 29, 38, 0.12); box-sizing: border-box;
}
.polls-channel-list.hidden { display: none !important; }
.polls-settings-extra .polls-block-title {
  font-size: calc(12px * var(--text-scale, 1));
  font-weight: 600;
  line-height: 1.2;
}
.polls-channel-option {
  display: block; width: 100%; appearance: none; border: 0; border-radius: 8px;
  background: transparent; color: #1a1d26; text-align: left;
  padding: 8px 10px; margin: 0; font: inherit;
  font-size: calc(13px * var(--text-scale, 1)); cursor: pointer; box-sizing: border-box;
}
.polls-channel-option:hover,
.polls-channel-option.is-active {
  background: color-mix(in srgb, var(--accent, #1c58d9) 10%, #fff);
}
.polls-channel-empty {
  padding: 10px 12px; color: #6b7080; font-size: calc(13px * var(--text-scale, 1));
}
.polls-options-editor { display: flex; flex-direction: column; gap: 8px; position: relative; }
.polls-option-row {
  display: flex; align-items: center; gap: 6px;
  transition: box-shadow .15s ease, transform .15s ease, opacity .15s ease;
  border-radius: 10px;
  will-change: transform;
}
.polls-option-row.is-dragging {
  position: fixed;
  z-index: 80;
  margin: 0;
  padding: 2px;
  opacity: 1;
  pointer-events: none;
  background: #fff;
  box-shadow: 0 10px 28px rgba(26, 29, 38, 0.18);
  outline: 1px solid color-mix(in srgb, var(--accent, #1c58d9) 28%, #e4e7ec);
}
.polls-option-spacer {
  border-radius: 10px;
  box-sizing: border-box;
  border: 1.5px dashed color-mix(in srgb, var(--accent, #1c58d9) 45%, #d0d4dc);
  background: color-mix(in srgb, var(--accent, #1c58d9) 6%, #fff);
  flex: none;
}
.polls-option-row input { flex: 1; min-width: 0; }
.polls-option-field {
  position: relative; flex: 1; min-width: 0;
}
.polls-option-field input {
  width: 100%;
  padding-right: 40px;
}
.polls-option-drag {
  appearance: none; border: 0; background: transparent; color: #9aa0ab;
  width: 28px; height: 32px; border-radius: 8px; padding: 0; cursor: grab;
  display: grid; place-items: center; flex: none;
  touch-action: none; user-select: none;
}
.polls-option-drag:active { cursor: grabbing; }
.polls-option-drag svg { width: 16px; height: 16px; display: block; pointer-events: none; }
.polls-option-remove {
  appearance: none; border: 0; background: transparent; color: #9aa0ab;
  width: 32px; height: 32px; border-radius: 8px; line-height: 1;
  cursor: pointer; flex: none; display: grid; place-items: center; padding: 0;
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  z-index: 1;
}
.polls-option-remove svg { width: 18px; height: 18px; display: block; }
.polls-option-remove:hover { color: #b42318; background: #fef3f2; }
.polls-option-remove:disabled { opacity: .35; cursor: default; }
.polls-option-correct {
  appearance: none; border: 1px solid #d5d9e2; background: #fff; color: #12b76a;
  width: 28px; height: 28px; border-radius: 8px; flex: none; cursor: pointer;
  display: grid; place-items: center; font-size: 14px; font-weight: 700; padding: 0;
}
.polls-option-correct.is-on { border-color: #12b76a; background: #ecfdf3; }
.polls-add-option {
  appearance: none; border: 0; background: transparent; color: #6b7080;
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 2px;
  font: inherit; font-size: calc(14px * var(--text-scale, 1)); font-weight: 400;
  cursor: pointer; align-self: flex-start;
}
.polls-add-option:hover { color: #1f2430; }
.polls-add-option-ico {
  width: 20px; height: 20px; display: grid; place-items: center;
  font-size: 18px; line-height: 1; font-weight: 500;
}
.polls-settings-block { padding-top: 6px; padding-bottom: 6px; gap: 6px; }
.polls-settings-head {
  appearance: none; border: 0; background: transparent; width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 2px 0; cursor: pointer; color: inherit; font: inherit; text-align: left;
}
.polls-settings-head .polls-block-title {
  font-size: calc(13px * var(--text-scale, 1));
  line-height: 1.2;
}
.polls-settings-chevron {
  width: 18px; height: 18px; flex: none; position: relative;
}
.polls-settings-chevron::before {
  content: "";
  position: absolute; left: 4px; top: 5px;
  width: 8px; height: 8px;
  border-right: 2px solid #6b7080; border-bottom: 2px solid #6b7080;
  transform: rotate(45deg); transition: transform .15s ease;
}
.polls-settings-head.is-open .polls-settings-chevron::before {
  top: 8px; transform: rotate(-135deg);
}
.polls-due-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 0 10px;
  margin: 0;
  border-bottom: 1px solid #eceef2;
  box-sizing: border-box;
}
.polls-setting:has(+ .polls-due-fields) {
  border-bottom: 0;
  padding-bottom: 6px;
}
.polls-settings-extra {
  display: flex; flex-direction: column; gap: 0;
}
.polls-setting {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  cursor: pointer; padding: 8px 0; margin: 0; font-weight: 400;
  font-size: calc(13px * var(--text-scale, 1)); line-height: 1.25;
  color: #1a1d26; user-select: none; min-height: 34px;
  border-bottom: 1px solid #eceef2; box-sizing: border-box;
}
.polls-setting:last-child { border-bottom: 0; }
.polls-setting-label {
  flex: 1; min-width: 0; font-weight: 400; color: #1f2430;
  line-height: 1.25; display: flex; align-items: center;
}
.polls-setting input[type="checkbox"] {
  position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none;
}
.polls-toggle-ui {
  flex: 0 0 42px; width: 42px; height: 24px; border-radius: 999px;
  display: inline-block; vertical-align: middle; box-sizing: border-box;
  background: #cfd3db; position: relative; transition: background .15s ease;
  align-self: center;
}
.polls-toggle-ui::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .15s ease;
}
.polls-setting input:checked + .polls-toggle-ui,
.polls-setting input[type="checkbox"]:checked + .polls-toggle-ui {
  background: var(--accent, #1c58d9);
}
.polls-setting input:checked + .polls-toggle-ui::after,
.polls-setting input[type="checkbox"]:checked + .polls-toggle-ui::after {
  transform: translateX(18px);
}
.media-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px;
}
.media-tile {
  position: relative; aspect-ratio: 1; border: 0; border-radius: 10px; padding: 0;
  overflow: hidden; cursor: pointer; background: #eef0f4; color: inherit;
}
.media-tile img, .media-tile video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.media-tile-badge {
  position: absolute; left: 6px; bottom: 6px; padding: 2px 6px; border-radius: 8px;
  background: rgba(0,0,0,.55); color: #fff; font-size: 11px; font-weight: 600;
}
.media-list { display: flex; flex-direction: column; gap: 6px; }
.media-row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  border: 1px solid #eef0f4; background: #fff; border-radius: 10px; padding: 10px 12px;
  cursor: pointer; color: inherit; font: inherit;
}
.media-row:hover { background: #f7f8fa; }
.media-row-ico {
  width: 36px; height: 36px; border-radius: 8px; flex: none;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent);
  font-size: 16px;
}
.media-row-meta { min-width: 0; flex: 1; }
.media-row-name {
  font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.media-row-sub { color: #8b8e98; font-size: 12px; margin-top: 2px; }
.media-more {
  margin-top: 14px; width: 100%; border: 1px solid #e4e7ec; background: #fff;
  border-radius: 10px; padding: 10px; cursor: pointer; font: inherit; font-weight: 600; color: #3f4350;
}
.media-more:hover { background: #f3f5f8; }
/* Profile action cards — unified height (as «Расширенные настройки»), black label. */
.card-media-btn,
.profile-visit .card-contact,
.profile-visit #open-settings.btn.wide {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin: 10px 0 0;
  padding: 0 14px;
  height: 52px;
  min-height: 52px;
  box-sizing: border-box;
  border: var(--glass-border);
  border-radius: 10px;
  background: var(--glass-chip-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  color: #1b1d21;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  line-height: 1.25;
  white-space: nowrap;
}
.card-media-btn:hover,
.profile-visit .card-contact:hover,
.profile-visit #open-settings.btn.wide:hover {
  background: rgba(255, 255, 255, 0.82);
  color: #1b1d21;
}
.card-rail-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
  margin: 10px 0 0;
  padding: 4px;
  height: 52px;
  min-height: 52px;
  box-sizing: border-box;
  border: var(--glass-border);
  border-radius: 10px;
  background: var(--glass-chip-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
}
.card-rail-tools.hidden { display: none !important; }
.card-rail-tools .rail-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  flex: 1 1 0;
  color: #3f4350;
  background: transparent;
}
.card-rail-tools .rail-btn:hover {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.45);
}
.card-rail-tools .rail-btn.is-active {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.55);
  box-shadow: inset 0 0 0 1px var(--accent-soft, #dce8f8);
}
.sidebar {
  width: 260px;
  background: color-mix(in srgb, var(--sidebar) var(--glass-menu-mix, 86%), transparent);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  color: #fff;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.sidebar-header {
  height: calc(56px + env(safe-area-inset-top, 0px));
  min-height: calc(56px + env(safe-area-inset-top, 0px));
  background: color-mix(in srgb, var(--sidebar-head) var(--glass-menu-mix, 86%), transparent);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  display: flex;
  align-items: center;
  gap: 12px;
  padding: env(safe-area-inset-top, 0px) 16px 0;
  box-sizing: border-box;
}
.sidebar-team-mark {
  display: none;
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  background: transparent;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
}
.sidebar-team-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.sidebar-heading { min-width: 0; flex: 1; }
.sidebar-logout {
  display: none;
  flex: none;
  width: 36px;
  height: 36px;
  margin-left: 4px;
  border: 0;
  border-radius: 10px;
  padding: 0;
  background: transparent;
  color: #e55353;
  place-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sidebar-logout svg {
  width: 22px;
  height: 22px;
  display: block;
}
.sidebar-logout:hover,
.sidebar-logout:focus-visible {
  background: rgba(229, 83, 83, .16);
  color: #ff6b6b;
  outline: none;
}
.sidebar-logout:active {
  background: rgba(229, 83, 83, .24);
}
html.capacitor-android .sidebar-logout {
  display: grid;
}
.sidebar-footer {
  display: none;
  flex: none;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--sidebar) var(--glass-menu-mix, 86%), transparent);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  min-width: 0;
}
.sidebar-me-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  width: 100%;
}
.sidebar-to-chat {
  display: none;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  appearance: none;
}
.sidebar-to-chat svg { display: block; }
.sidebar-to-chat:hover,
.sidebar-to-chat:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}
.sidebar-to-chat:disabled {
  opacity: 0.35;
  pointer-events: none;
}
.sidebar-rail-tools {
  display: none;
  flex: 1 1 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  min-width: 0;
  margin: 0;
  padding: 0;
}
.sidebar-rail-tools[hidden] { display: none !important; }
.sidebar-rail-tools .rail-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  flex: 0 0 auto;
}
.sidebar-me-btn {
  display: none;
  box-sizing: border-box;
  flex: 0 1 auto;
  width: auto;
  max-width: min(100%, 240px);
  min-width: 0;
  height: auto;
  min-height: 0;
  margin: 0;
  padding: 4px 8px 4px 4px;
  gap: 12px;
  border: 0;
  border-radius: 999px;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  background: transparent;
  color: #fff;
  cursor: pointer;
  overflow: visible;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.sidebar-me-btn:hover,
.sidebar-me-btn:focus,
.sidebar-me-btn:focus-visible,
.sidebar-me-btn:active {
  background: transparent;
  outline: none;
  box-shadow: none;
}
.sidebar-me-btn .avatar {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  max-width: 44px !important;
  max-height: 44px !important;
  flex: 0 0 44px !important;
  font-size: 16px;
  align-self: center;
}
.sidebar-me-btn .avatar .presence {
  width: 13px;
  height: 13px;
  right: 0;
  bottom: 0;
}
.sidebar-me-name {
  display: block;
  min-width: 0;
  flex: 1 1 auto;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}
.team-name { font-weight: 700; font-size: calc(16px * var(--text-scale, 1)); }
.team-sub { font-size: 12px; opacity: .8; display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #3db887; display: inline-block; }
.sidebar-scroll { flex: 1; overflow: auto; min-height: 0; }
.sidebar .filter {
  display: block;
  width: calc(100% - 24px);
  max-width: calc(100% - 24px);
  min-width: 0;
  margin: 12px;
  background: rgba(0,0,0,.2);
  border: none;
  color: #fff;
  border-radius: 4px;
  padding: 8px 10px;
}
.sidebar .filter::placeholder { color: rgba(255,255,255,.65); }
.sidebar .filter:focus-visible { outline: 2px solid rgba(255,255,255,.75); outline-offset: -2px; }
.section-head {
  display: flex; align-items: center; gap: 6px; padding: 14px 8px 4px 16px;
}
.section-head > span:first-child {
  font-size: calc(12px * var(--text-scale, 1)); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .75;
}
.section-head .icon-btn { margin-left: auto; }
.section-head.is-collapsible {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
#channel-list.is-collapsed:not(.is-searching),
#dm-list.is-collapsed:not(.is-searching) {
  display: none !important;
}
#channel-actions.is-collapsed {
  display: none !important;
}
/* Tight Channels ↔ DMs gap (collapsed or empty), desktop + mobile. */
#channels-section-head {
  padding-bottom: 2px;
}
#dm-section-head {
  padding-top: 6px;
}
#channel-list.is-collapsed + #dm-section-head {
  padding-top: 2px;
}
.inline-actions { display: flex; flex-direction: column; padding: 0 8px 6px; }
.inline-actions button {
  background: transparent; border: none; color: #fff; text-align: left; padding: 7px 10px; border-radius: 4px;
}
.inline-actions button:hover { background: rgba(255,255,255,.08); }
.nav-item {
  width: calc(100% - 16px); margin: 1px 8px; display: flex; align-items: center; gap: 8px;
  border: none; background: transparent; color: rgba(255,255,255,.78); border-radius: 4px;
  padding: 6px 10px; text-align: left; min-width: 0; overflow: hidden;
  font-size: calc(14px * var(--text-scale, 1));
}
.nav-item:hover { background: rgba(255,255,255,.08); }
.nav-item.active { background: rgba(255,255,255,.16); color: #fff; }
.nav-item.active.tools-open {
  margin-bottom: 0;
}
.settings-item { gap: 10px; }
.settings-item svg { flex: none; opacity: .9; }
.settings-item.active { box-shadow: inset 3px 0 0 var(--accent-mark); }
#settings-home {
  margin-top: 8px;
  gap: 10px;
}
#settings-home svg { flex: none; opacity: .9; }
#settings-nav, #accounts-nav { display: none; }

#mail-nav { display: none; }
.app.accounts-level #settings-root { display: none; }
.app.accounts-level #accounts-nav { display: block; }
.account-filter .badge { background: var(--accent); }
.account-filter.active { box-shadow: inset 3px 0 0 var(--accent-mark); }
.app.settings-open #chat-nav { display: none; }

.app.settings-open #mail-nav { display: none; }
.app.settings-open #settings-nav { display: block; }
/* Desktop: plugins rail swaps channel list for extensions inside chat-nav */
@media (min-width: 801px) {

  

  /* Mail rail swaps channel list for connected mailboxes */
  .app.mail-mode:not(.settings-open) #chat-nav { display: block; }
  .app.mail-mode:not(.settings-open) #mail-nav { display: block; }
  .app.mail-mode:not(.settings-open) #chat-nav > :not(#mail-nav) { display: none !important; }
  .app.mail-mode:not(.settings-open) #filter { display: none !important; }
}
#mail-nav .section-head { user-select: none; }
#mail-account-list .mail-account-block { margin-bottom: 6px; }
#mail-account-list .hash {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#mail-account-list .hash svg { display: block; opacity: .9; }
#mail-account-list .nav-item .nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#mail-account-list .mail-folder-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 2px 0 4px;
  padding: 0 0 0 10px;
}
#mail-account-list .mail-folder-group-head {
  opacity: .85;
  font-weight: 600;
}
#mail-account-list .mail-folder-children {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-left: 14px;
}
#mail-account-list .mail-folder-item {
  min-height: 28px;
  padding: 4px 10px 4px 14px;
  font-size: calc(13px * var(--text-scale, 1));
  opacity: .92;
}
#mail-account-list .mail-folder-item .badge {
  margin-left: auto;
  font-size: 11px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
}
.app.mail-mode .feature-card {
  width: 100%;
  max-width: none;
  align-self: stretch;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.app.mail-mode .feature-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  flex: 1 1 auto;
  height: 100%;
  overflow: hidden;
}
.app.mail-mode #feature-back,
.app.mail-mode #feature-title,
.app.mail-mode .feature-lead {
  display: none !important;
}
.app.mail-mode #feature-toolbar.hidden {
  display: none !important;
}
.app.mail-mode #media-btn {
  display: none !important;
}
/* Mail header uses the same box as the main channel header. */
.app.mail-mode .channel-header {
  align-items: center;
  align-content: center;
}
.app.rail-feature-open.mail-mode.feature-chrome-open .channel-header {
  left: 18px;
  right: 18px;
  margin: 0;
  padding: 6px 8px 6px 6px;
  /* Collapsed search/notif rows must not add height under the title. */
  gap: 0 8px;
  min-height: 60px;
  align-items: center;
  align-content: center;
}
.app.mail-mode .channel-header > .header-actions {
  align-self: center;
  margin-left: auto;
}
.app.mail-mode #channel-heading-btn {
  display: flex;
  flex-direction: row;
  align-items: center;
  align-self: center;
  gap: 8px;
  min-width: 0;
  padding: 0 2px;
  margin: 0;
  line-height: 1.2;
}
.app.mail-mode #channel-heading-btn .channel-title {
  flex: 0 1 auto;
  min-width: 0;
  font-size: calc(16px * var(--text-scale, 1));
  line-height: 1.2;
  gap: 4px;
  align-items: center;
}
.app.mail-mode #channel-topic.mail-header-login {
  display: inline-flex;
  align-items: center;
  flex: 0 1 auto;
  max-width: min(360px, 46vw);
  margin: 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #2a2d35;
  font-size: calc(11px * var(--text-scale, 1));
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: inset 0 0 0 1px rgba(42, 45, 53, 0.08);
}
.app.mail-mode .header-mail-search-slot,
.app.mail-mode .header-notif-slot {
  margin-top: 0;
}
.app.mail-mode .header-mail-search-panel {
  padding-top: 4px;
  padding-bottom: 2px;
}

@media (max-width: 800px) {

  

  

  

  

  

  
}

.nav-item.unread { color: #fff; font-weight: 700; }
.nav-item .avatar {
  width: 24px; height: 24px; min-width: 24px; min-height: 24px; max-width: 24px; max-height: 24px;
  flex: 0 0 24px; font-size: 11px;
}
.nav-item .avatar .presence { width: 10px; height: 10px; right: -1px; bottom: -1px; border-width: 1px; }
.hash { width: 18px; flex: none; text-align: center; font-weight: 700; opacity: .85; }
.hash.is-private {
  font-size: 0;
  line-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: .75;
}
.ico-lock {
  position: relative;
  display: inline-block;
  width: 12px;
  height: 14px;
  flex: none;
  color: inherit;
  opacity: .85;
  vertical-align: -1px;
}
.ico-lock::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0;
  width: 8px;
  height: 6px;
  border: 1.5px solid currentColor;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  box-sizing: border-box;
  background: transparent;
}
.ico-lock::after {
  content: "";
  position: absolute;
  left: 0;
  top: 5px;
  width: 12px;
  height: 9px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  box-sizing: border-box;
  background: transparent;
}
#channel-prefix.is-lock {
  font-size: 0;
  line-height: 0;
  display: inline-flex;
  align-items: center;
  width: 16px;
  opacity: .75;
}
#channel-prefix.is-lock .ico-lock {
  opacity: 1;
}
.forward-channel-mark.is-private {
  font-size: 0;
}
.forward-channel-mark.is-private .ico-lock {
  width: 14px;
  height: 16px;
  opacity: .7;
  color: #5b6170;
}
.forward-channel-mark.is-private .ico-lock::before {
  left: 3px;
  width: 8px;
  height: 7px;
}
.forward-channel-mark.is-private .ico-lock::after {
  width: 14px;
  height: 10px;
}
.nav-label {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.badge {
  margin-left: auto; flex: 0 0 auto; background: rgba(255,255,255,.28); color: #fff; border-radius: 10px;
  min-width: 18px; height: 18px; padding: 0 5px; font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.nav-item .badge { background: var(--accent-mark); color: #0b1220; }
.badge.mention { background: #d24b4e; color: #fff; }
.section-head .badge {
  margin-left: 6px; margin-right: auto; background: var(--accent-mark); color: #0b1220;
}
.section-head .badge.hidden { display: none !important; }
.side-empty { font-size: 12px; opacity: .7; padding: 4px 16px 10px; }
#admin-users .side-empty { color: #6b7080; opacity: 1; padding-left: 0; }
.accounts-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  min-width: 0;
}
.accounts-panel-head h1 {
  margin: 0;
  min-width: 0;
  flex: 1;
}
.accounts-panel-head .accounts-add-user {
  flex: none;
  padding: 2px 0;
  margin: 0;
}
.accounts-add-user {
  appearance: none; border: 0; background: transparent; color: #6b7080;
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 2px 4px;
  font: inherit; font-size: calc(14px * var(--text-scale, 1)); font-weight: 400;
  cursor: pointer; align-self: flex-start;
}
.accounts-add-user:hover { color: #1f2430; }
.accounts-add-user.hidden,
.accounts-add-user[hidden] { display: none !important; }
.accounts-add-user-ico {
  width: 20px; height: 20px; display: grid; place-items: center;
  font-size: 18px; line-height: 1; font-weight: 500;
}
.accounts-add-dialog { width: min(420px, 100%); }
.accounts-add-search {
  width: 100%; box-sizing: border-box; border: 1px solid #e4e7ec; border-radius: 10px;
  padding: 10px 12px; font: inherit; font-size: calc(15px * var(--text-scale, 1));
  color: #1a1d26; background: #fff; margin-bottom: 10px;
}
.accounts-add-search:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, #fff); outline-offset: 1px;
  border-color: color-mix(in srgb, var(--accent) 40%, #d0d4dc);
}
.accounts-add-list {
  display: flex; flex-direction: column; gap: 4px;
  max-height: min(360px, 55vh); overflow: auto;
}
.accounts-add-option {
  appearance: none; border: 0; border-radius: 10px; background: transparent;
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  width: 100%; text-align: left; padding: 10px 12px; margin: 0;
  cursor: pointer; font: inherit; color: #1a1d26; box-sizing: border-box;
}
.accounts-add-option:hover {
  background: color-mix(in srgb, var(--accent, #1c58d9) 10%, #fff);
}
.accounts-add-option strong {
  font-size: calc(14px * var(--text-scale, 1)); font-weight: 600;
}
.accounts-add-option span {
  color: #8b8e98; font-size: calc(12px * var(--text-scale, 1));
}
.sidebar-scroll::-webkit-scrollbar, .messages::-webkit-scrollbar, .rhs-list::-webkit-scrollbar { width: 8px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.25); border-radius: 4px; }
.rhs-list::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }
.messages {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
.messages::-webkit-scrollbar-track { background: transparent; }
.messages::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 4px;
}
.messages:hover::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.18);
}
.messages:hover {
  scrollbar-color: rgba(0, 0, 0, 0.18) transparent;
}

.me-bar { position: relative; }
.me-button {
  display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0;
  background: transparent; border: none; border-radius: 50%; color: var(--text-strong);
  overflow: visible;
  -webkit-tap-highlight-color: transparent;
}
.me-button:hover,
.me-button:focus,
.me-button:focus-visible,
.me-button:active {
  background: transparent;
  outline: none;
  box-shadow: none;
}
.me-button .avatar {
  width: 32px; height: 32px; min-width: 32px; min-height: 32px; max-width: 32px; max-height: 32px;
  flex: 0 0 32px; font-size: 12px;
}
.user-menu {
  display: none; position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: 280px;
  background: #fff; color: var(--text-strong); border-radius: 8px; box-shadow: 0 12px 40px rgba(0,0,0,.22);
  padding: 6px 0; text-align: left; max-height: calc(100vh - 80px); overflow: auto;
}
.me-bar:hover .user-menu, .me-bar.menu-open .user-menu { display: block; }
.me-bar.menu-suppressed:hover .user-menu { display: none; }
.user-menu.in-panel { display: block; position: static; width: 100%; max-height: none; box-shadow: none; border-radius: 0; }
.account-host { overflow: auto; flex: 1; }
/* Rail avatar stays visible so it can toggle the profile card closed. */
.app.settings-open .user-menu { display: none !important; }
.user-menu-head { display: flex; gap: 12px; align-items: center; padding: 12px 16px 14px; }
.user-menu-head .avatar {
  width: 52px; height: 52px; min-width: 52px; min-height: 52px; max-width: 52px; max-height: 52px;
  flex: 0 0 52px; font-size: 18px;
}
.user-menu-head .avatar .presence {
  width: 14px; height: 14px; right: 0; bottom: 0;
}
.rhs-head .user-menu-head { flex: 1; min-width: 0; padding: 0 8px 0 0; }
.rhs-head .user-menu-head .avatar {
  width: 36px; height: 36px; min-width: 36px; min-height: 36px; max-width: 36px; max-height: 36px;
  flex: 0 0 36px; font-size: 14px;
}
.user-menu-id { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.user-menu-ask {
  color: #8b8e98; font-size: 12px; font-weight: 500; line-height: 1.2;
}
.user-menu-id strong { font-size: 16px; line-height: 1.25; }
.user-menu-id span { color: #6b7080; font-size: 13px; }
.user-menu-custom:empty { display: none; }
.user-menu-row {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  border: none; border-top: 1px solid #f0f0f0; background: #fff; color: var(--text-strong); text-align: left; font-size: 15px;
}
.user-menu-row:hover { background: var(--accent-soft); }
.user-menu-row.selected { color: var(--accent); background: var(--accent-soft); }
#availability-toggle .chevron, #card-availability-toggle .chevron {
  margin-left: auto; width: 8px; height: 8px; border-right: 2px solid #8b8e98; border-bottom: 2px solid #8b8e98;
  transform: rotate(45deg); transition: transform .15s ease;
}
#availability-toggle[aria-expanded="true"] .chevron,
#card-availability-toggle[aria-expanded="true"] .chevron { transform: rotate(-135deg); }
.availability-list .user-menu-row { padding-left: 28px; min-height: 44px; }
.status-ico {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  flex: none; position: relative; background: #e8eaef; color: #5b6070;
}
.status-ico.online { background: #3db887; }
.status-ico.away { background: #f5a623; }
.status-ico.dnd { background: #d24b4e; }
.status-ico.offline { background: transparent; border: 2px solid #c5c8d0; }
.status-ico.online::before {
  content: ""; width: 5px; height: 9px; border-right: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(45deg) translate(-1px, -1px);
}
.status-ico.away::before {
  content: ""; width: 8px; height: 8px; border: 2px solid #fff; border-radius: 50%;
  border-right-color: transparent; transform: rotate(-45deg);
}
.status-ico.dnd::before {
  content: ""; width: 10px; height: 2px; background: #fff; border-radius: 1px;
}
.status-ico.status-custom::before {
  content: ""; width: 10px; height: 10px; border: 2px solid currentColor; border-radius: 50%;
  box-shadow: inset 0 -3px 0 currentColor;
}
.status-ico.status-profile::before {
  content: ""; width: 8px; height: 8px; border: 2px solid currentColor; border-radius: 50%;
  margin-top: -5px;
}
.status-ico.status-profile::after {
  content: ""; width: 12px; height: 6px; border: 2px solid currentColor; border-bottom: none;
  border-radius: 8px 8px 0 0; margin-top: 8px; position: absolute;
}
.status-ico.status-logout::before {
  content: ""; width: 8px; height: 8px; border: 2px solid currentColor; border-left: none;
  border-radius: 0 3px 3px 0; margin-left: 2px;
}
.status-ico.status-logout::after {
  content: ""; position: absolute; left: 4px; width: 8px; height: 2px; background: currentColor;
  box-shadow: 3px -3px 0 -0.5px currentColor, 3px 3px 0 -0.5px currentColor;
}
.user-menu-form { padding: 8px 16px 10px; border-top: 1px solid #f0f0f0; }
.user-menu-form input { width: 100%; border: 1px solid #d0d4dc; border-radius: 4px; padding: 8px 10px; }
.popover {
  position: absolute; left: 60px; bottom: 8px; background: #fff; color: #3f4350;
  border-radius: 4px; box-shadow: 0 8px 24px rgba(0,0,0,.2); min-width: 180px; z-index: 13; padding: 6px 0;
}
.popover button {
  display: block; width: 100%; text-align: left; background: none; border: none; padding: 8px 14px; color: #3f4350;
}
.popover button:hover { background: #f2f4f8; }

.main {
  position: relative; flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0;
  overflow: hidden;
  background: transparent;
}
.chat-wallpaper {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: var(--wallpaper-color, #d0e7f5);
  background-image: var(--wallpaper-gradient, none);
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center top;
  overflow: hidden;
}
.chat-wallpaper::after {
  content: none;
  display: none;
}
html[data-wallpaper="pattern"] .chat-wallpaper::after {
  content: none;
  display: none;
}
html[data-wallpaper="custom"] .chat-wallpaper {
  background-image: var(--wallpaper-image-mobile, none);
  background-size: var(--wallpaper-size-mobile, cover);
  background-position: var(--wallpaper-pos-mobile, center center);
}
html[data-wallpaper="space"] .chat-wallpaper {
  background-color: var(--wallpaper-color, #d0e7f5);
  background-image:
    var(--wallpaper-image-mobile, none),
    var(--wallpaper-space-gradient, linear-gradient(135deg, #fff2ff 0%, #eed5f0 25%, #dbcdf8 50%, #81d1f5 75%, #72cbf1 100%));
  background-size: var(--wallpaper-size-mobile, cover), cover;
  background-position: var(--wallpaper-pos-mobile, center center), center;
  background-repeat: no-repeat, no-repeat;
}
html[data-wallpaper="custom"] .chat-wallpaper::after,
html[data-wallpaper="space"] .chat-wallpaper::after {
  content: none;
  display: none;
}
@media (min-width: 801px) {
  html[data-wallpaper="custom"] .chat-wallpaper {
    background-image: var(--wallpaper-image-desktop, none);
    background-size: var(--wallpaper-size-desktop, cover);
    background-position: var(--wallpaper-pos-desktop, center center);
  }
  html[data-wallpaper="space"] .chat-wallpaper {
    background-image:
      var(--wallpaper-image-desktop, none),
      var(--wallpaper-space-gradient, linear-gradient(135deg, #fff2ff 0%, #eed5f0 25%, #dbcdf8 50%, #81d1f5 75%, #72cbf1 100%));
    background-size: var(--wallpaper-size-desktop, cover), cover;
    background-position: var(--wallpaper-pos-desktop, center center), center;
  }
  html[data-wallpaper="custom"],
  html[data-wallpaper="custom"] body {
    background-image: var(--wallpaper-image-desktop, none);
    background-size: var(--wallpaper-size-desktop, cover);
    background-position: var(--wallpaper-pos-desktop, center center);
  }
  html[data-wallpaper="space"],
  html[data-wallpaper="space"] body {
    background-image:
      var(--wallpaper-image-desktop, none),
      var(--wallpaper-space-gradient, linear-gradient(135deg, #fff2ff 0%, #eed5f0 25%, #dbcdf8 50%, #81d1f5 75%, #72cbf1 100%));
    background-size: var(--wallpaper-size-desktop, cover), cover;
    background-position: var(--wallpaper-pos-desktop, center center), center;
  }
}
.main > *:not(.chat-wallpaper) {
  position: relative;
  z-index: 1;
}
/* Win over the rule above — settings/feature/TG Web overlays must be absolute. */
.main > .settings-screen,
.main > .feature-screen {
  position: absolute;
  inset: 0;
  z-index: 6;
}
/* Reconnect strip kept in DOM for layout hooks; text banner removed. */
.banner { display: none !important; }
/* Compact glass header (same look on desktop and mobile). */
.channel-header {
  height: auto;
  min-height: 60px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: center;
  /* No row-gap while search/notif slots are collapsed (0fr). */
  gap: 0 8px;
  margin: 8px 12px 0;
  padding: 6px 8px 6px 6px;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  border: var(--glass-border);
  border-radius: 8px;
  overflow: visible;
  box-sizing: border-box;
  flex: none;
  z-index: 3;
}
.channel-header .menu-toggle,
.channel-header .icon-btn {
  width: var(--chrome-icon-btn);
  height: var(--chrome-icon-btn);
  background: transparent;
}
.channel-header .icon-btn:hover,
.channel-header .icon-btn:active {
  background: transparent;
  color: var(--accent);
}
.channel-header .menu-toggle svg,
.channel-header .icon-btn svg {
  width: var(--chrome-icon-svg);
  height: var(--chrome-icon-svg);
}
.channel-header .channel-avatar-btn .avatar,
.channel-header #channel-avatar {
  width: 36px;
  height: 36px;
}
.pinned-banner {
  flex: none; display: flex; align-items: stretch; gap: 4px;
  margin: 6px 12px 0;
  padding: 6px 8px 6px 10px;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  border: var(--glass-border);
  border-radius: 8px;
  z-index: 3;
}
.pinned-banner.hidden { display: none !important; }
.pinned-banner-main {
  appearance: none; border: 0; background: transparent; padding: 2px 0;
  flex: 1; min-width: 0; display: flex; align-items: stretch; gap: 10px;
  text-align: left; cursor: pointer; font: inherit; color: inherit;
}
.pinned-banner-bar {
  width: 2px; border-radius: 2px; background: #1a1d26; flex: none; align-self: stretch;
}
.pinned-banner-copy {
  min-width: 0; display: flex; flex-direction: column; gap: 1px; justify-content: center;
}
.pinned-banner-title {
  font-size: calc(13px * var(--text-scale, 1)); font-weight: 700; color: #1a1d26; line-height: 1.25;
}
.pinned-banner-preview {
  font-size: calc(13px * var(--text-scale, 1)); color: #5c6270; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pinned-banner-close {
  appearance: none; border: 0; background: transparent; color: #9aa0ab;
  width: 32px; height: 32px; border-radius: 8px; cursor: pointer; flex: none;
  align-self: center; font-size: 20px; line-height: 1; padding: 0;
}
.pinned-banner-close:hover { color: #1a1d26; background: #f3f5f8; }
.pinned-banner-close.hidden { display: none !important; }
.msg.msg-flash { animation: msg-flash-pulse .9s ease; }
@keyframes msg-flash-pulse {
  0%, 100% { filter: none; }
  35% { filter: brightness(0.96); }
}
.app.rail-feature-open .pinned-banner { display: none !important; }
/* Mobile shared-element: sidebar → header fly (see runHeaderFly in app.js). */
.header-fly-clone {
  position: fixed;
  z-index: 10060;
  margin: 0;
  padding: 0;
  pointer-events: none;
  will-change: transform, opacity, color;
  box-sizing: border-box;
  overflow: hidden;
}
.header-fly-label {
  white-space: nowrap;
  text-overflow: ellipsis;
  letter-spacing: inherit;
  font-family: inherit;
}
.header-fly-avatar {
  border-radius: 50%;
  overflow: visible;
  line-height: 0;
}
.header-fly-avatar .avatar {
  display: block;
  border-radius: 50%;
}
.channel-header.is-fly-pending #channel-name,
.channel-header.is-fly-pending #channel-avatar-btn,
.channel-header.is-fly-pending #channel-prefix,
.channel-header.is-fly-pending #channel-topic {
  opacity: 0 !important;
}
.channel-header:not(.is-fly-pending) #channel-name,
.channel-header:not(.is-fly-pending) #channel-avatar-btn,
.channel-header:not(.is-fly-pending) #channel-prefix,
.channel-header:not(.is-fly-pending) #channel-topic {
  transition: opacity .12s ease;
}

.channel-avatar-btn {
  appearance: none; border: 0; background: transparent; padding: 2px; cursor: pointer;
  flex: none; border-radius: 50%; overflow: visible; line-height: 0;
}
.channel-avatar-btn.hidden { display: none !important; }
.channel-avatar-btn .avatar { width: 36px; height: 36px; font-size: 14px; }
.channel-avatar-btn:hover .avatar { box-shadow: 0 0 0 2px var(--accent-soft); }
.channel-heading { min-width: 0; flex: 1; text-align: left; align-self: center; }
.channel-header > .header-actions { align-self: center; }
.channel-heading-btn {
  appearance: none; border: 0; background: transparent; padding: 0; cursor: pointer;
  color: inherit; font: inherit; border-radius: 8px; padding: 2px 6px; margin: -2px -6px;
}
.channel-heading-btn:hover,
.channel-heading-btn:focus,
.channel-heading-btn:active {
  background: transparent;
  color: inherit;
  outline: none;
}
.channel-heading-btn.is-profile {
  cursor: default;
  pointer-events: none;
}
.channel-title {
  font-weight: 700;
  font-size: calc(16px * var(--text-scale, 1));
  display: flex;
  gap: 6px;
  align-items: baseline;
  flex-wrap: nowrap;
  min-width: 0;
}
#channel-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.channel-title-sep {
  color: #8b8e98;
  font-weight: 700;
  flex: 0 0 auto;
}
.channel-title-sep.hidden { display: none !important; }
.channel-title-dialogues {
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  flex: 0 0 auto;
  white-space: nowrap;
}
.channel-title-dialogues.hidden { display: none !important; }
.channel-title-dialogues:hover,
.channel-title-dialogues:focus,
.channel-title-dialogues:active {
  color: inherit;
  text-decoration: none;
  outline: none;
  background: transparent;
}
#channel-prefix { color: #8b8e98; flex: 0 0 auto; }
.channel-topic { color: #8b8e98; font-size: calc(13px * var(--text-scale, 1)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel-topic.is-typing { color: #8b8e98; font-weight: 400; }
#channel-list {
  /* Small reserve so DMs stay close; tools row adds its own height when mounted. */
  padding-bottom: 4px;
}
#channel-list:has(> .chat-tools) {
  padding-bottom: 0;
}
#channel-list.is-collapsed {
  padding-bottom: 0;
}
.chat-tools {
  display: flex; align-items: center; gap: 2px; flex: none;
  width: calc(100% - 16px); margin: 0 8px 4px; padding: 2px 6px 4px 10px;
  box-sizing: border-box;
  background: transparent;
  border-radius: 0;
  min-height: 32px;
}
.chat-tools.is-dm { padding-left: 10px; }
/* Collapsed / parked: never reserve space under channel or DM rows. */
#channel-list > .chat-tools.is-collapsed,
#dm-list > .chat-tools.is-collapsed,
.chat-tools.is-collapsed,
.chat-tools.hidden {
  display: none !important;
  visibility: hidden;
  pointer-events: none;
  height: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
}
.chat-tool-btn {
  appearance: none; border: 0; background: transparent; color: rgba(255,255,255,.78);
  width: 32px; height: 28px; border-radius: 8px; padding: 0;
  display: grid; place-items: center; cursor: pointer; flex: none;
  -webkit-tap-highlight-color: transparent;
}
.chat-tool-btn svg { display: block; width: 18px; height: 18px; }
.chat-tool-btn:hover { color: #fff; background: rgba(255,255,255,.1); }
.chat-tool-btn:focus-visible { outline: 2px solid rgba(255,255,255,.75); outline-offset: 2px; }
.chat-tool-btn.is-active {
  color: #fff; background: rgba(255,255,255,.16);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.chat-tool-btn.hidden { display: none !important; }
.profile-visit.is-readonly .visit-edit,
.profile-visit.is-readonly #card-avatar-clear,
.profile-visit.is-readonly #open-settings,
.profile-visit.is-readonly .card-availability .chevron { display: none !important; }
.profile-visit.is-readonly #card-availability-toggle { pointer-events: none; cursor: default; }
.profile-visit.is-readonly #card-avatar { cursor: default; }
.header-actions { display: flex; align-items: center; gap: 4px; min-width: 0; }
#header-notifications {
  position: relative;
  margin-left: -10px;
}
#header-notifications .header-ico-sat {
  display: block;
  pointer-events: none;
  width: var(--chrome-icon-svg);
  height: var(--chrome-icon-svg);
  color: #8b8e98;
  flex: none;
}
#header-notifications.has-alerts .header-ico-sat {
  animation: header-notif-blink .9s ease-in-out infinite;
}
#header-notifications.is-muted .header-ico-sat {
  color: #b0b4be;
  opacity: .45;
  animation: none !important;
}
@keyframes header-notif-blink {
  0%, 100% { color: #c5c8d0; }
  50% { color: #2f6bff; }
}
/* Same expand mechanic as composer format toolbar: grows inside the header glass. */
.header-notif-slot {
  display: grid;
  grid-template-rows: 0fr;
  flex: 1 0 100%;
  width: 100%;
  min-width: 0;
  margin: 0;
  opacity: 0;
  pointer-events: none;
  position: relative;
  z-index: 1;
  transition:
    grid-template-rows .34s cubic-bezier(.22, .61, .36, 1),
    opacity .26s ease;
}
html.header-notif-open .header-notif-slot {
  grid-template-rows: 1fr;
  opacity: 1;
  pointer-events: auto;
}
.header-notif-slot-inner {
  min-height: 0;
  overflow: hidden;
}
.header-notif-panel {
  margin: 0;
  padding: 8px 2px 2px;
  background: transparent;
  border: 0;
  border-top: 1px solid rgba(180, 186, 198, 0.45);
  border-radius: 0;
  box-shadow: none;
  transform: translateY(-8px);
  opacity: 0;
  transition:
    transform .34s cubic-bezier(.22, .61, .36, 1),
    opacity .26s ease;
}
html.header-notif-open .header-notif-panel {
  transform: translateY(0);
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  .header-notif-slot,
  .header-notif-panel {
    transition: none !important;
  }
}
/* Mail search C: strip expands inside the glass header (same motion as notif). */
.header-mail-search-slot {
  display: grid;
  grid-template-rows: 0fr;
  flex: 1 0 100%;
  width: 100%;
  min-width: 0;
  margin: 0;
  opacity: 0;
  pointer-events: none;
  position: relative;
  z-index: 1;
  transition:
    grid-template-rows .34s cubic-bezier(.22, .61, .36, 1),
    opacity .26s ease;
}
html.header-mail-search-open .header-mail-search-slot {
  grid-template-rows: 1fr;
  opacity: 1;
  pointer-events: auto;
}
.header-mail-search-slot-inner {
  min-height: 0;
  overflow: hidden;
}
.header-mail-search-panel {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 8px 2px 4px;
  background: transparent;
  border: 0;
  border-top: 1px solid rgba(180, 186, 198, 0.45);
  border-radius: 0;
  box-shadow: none;
  transform: translateY(-8px);
  opacity: 0;
  transition:
    transform .34s cubic-bezier(.22, .61, .36, 1),
    opacity .26s ease;
}
html.header-mail-search-open .header-mail-search-panel {
  transform: translateY(0);
  opacity: 1;
}
.header-mail-search-field {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}
.header-mail-search-panel input {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 34px;
  margin: 0;
  padding: 0 96px 0 12px;
  border: 1px solid rgba(180, 186, 198, 0.55);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: #1f2328;
  font: inherit;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
}
.header-mail-search-panel input:focus {
  border-color: rgba(90, 140, 220, 0.65);
  box-shadow: 0 0 0 2px rgba(90, 140, 220, 0.18);
}
.header-mail-search-panel input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}
.header-mail-search-scope {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 42%;
  height: 24px;
  margin: 0;
  padding: 0 8px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #2a2d35;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(42, 45, 53, 0.1);
  z-index: 1;
}
.header-mail-search-scope:hover {
  background: #f7f8fa;
}
.header-mail-search-scope svg {
  flex: none;
  opacity: 0.55;
}
html.header-feature-search .header-mail-search-scope { display: none; }
html.header-feature-search .header-mail-search-panel input { padding-right: 12px; }
.header-mail-search-close {
  flex: none;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #6b7280;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.header-mail-search-close:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #1f2328;
}
@media (prefers-reduced-motion: reduce) {
  .header-mail-search-slot,
  .header-mail-search-panel {
    transition: none !important;
  }
}
.header-notif-empty {
  margin: 0;
  text-align: center;
  color: #8b8e98;
  font-size: 14px;
  line-height: 1.4;
  padding: 10px 6px;
}
.header-notif-msg {
  appearance: none;
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 6px 4px 2px;
  text-align: left;
  cursor: pointer;
  color: var(--text-strong, #1a1d26);
  display: grid;
  gap: 2px;
}
.header-notif-msg:hover { background: rgba(255, 255, 255, .35); }
.header-notif-msg-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.header-notif-msg-who {
  font-size: 13px;
  font-weight: 650;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.header-notif-msg-time {
  flex: none;
  font-size: 12px;
  color: #8b8e98;
}
.header-notif-msg-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
  color: #3f4350;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
}
.member-menu-wrap { position: relative; display: flex; align-items: center; gap: 4px; }
.member-search-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 12; width: 260px;
  background: var(--glass-chip-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  border: var(--glass-border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.08); padding: 8px;
}
.member-search-menu input,
.member-search-menu input[type="text"] {
  width: 100%;
  border: 1px solid rgba(216, 216, 220, 0.65);
  border-radius: 4px;
  padding: 8px 10px;
  background: transparent;
}
.member-search-menu input:focus-visible,
.member-search-menu input[type="text"]:focus-visible {
  outline: none;
  background: rgba(255, 255, 255, 0.22);
}
.member-search-results { max-height: 280px; overflow: auto; margin-top: 6px; }
.member-search-results button {
  width: 100%; display: flex; align-items: center; gap: 8px; text-align: left;
  border: none; background: transparent; border-radius: 4px; padding: 6px 8px; color: var(--text-strong);
}
.member-search-results button:hover { background: var(--accent-soft); }
.member-search-results .avatar { width: 28px; height: 28px; font-size: 11px; }
.member-search-empty { color: #8b8e98; font-size: 13px; padding: 8px; }
.member-search-results .chat-search-hit {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.member-search-results .chat-search-hit strong {
  font-size: 13px;
  color: var(--text-strong);
}
.member-search-results .chat-search-hit span {
  font-size: 12px;
  color: #6b7080;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
/* Header search = in-chat search (DM/channel), not people directory. */
.header-ico-members { display: none !important; }
.header-ico-search { display: block !important; }
/* Own profile lives in the left rail — never next to outgoing bubbles. */
.msg.mine .msg-avatar-slot {
  display: none !important;
}
/* DM header: avatar + name are enough (no @ / member count). */
.channel-heading-btn.is-profile #channel-prefix {
  display: none !important;
}
.channel-heading-btn.is-profile ~ .header-actions #member-count {
  display: none !important;
}
/* Keep glass header + search popover above the message list. */
.main > .channel-header {
  z-index: 12;
}
.channel-header .member-menu-wrap {
  z-index: 13;
}
.channel-header .member-search-menu {
  z-index: 40;
}
.count { color: #8b8e98; font-size: 13px; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 4px; border: none; background: transparent; color: #555;
  display: grid; place-items: center; font-size: 20px; line-height: 1;
}
.icon-btn:hover { background: #f2f2f2; }
.sidebar .icon-btn { color: #fff; }
.sidebar .icon-btn:hover { background: rgba(255,255,255,.12); }

.thread {
  position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column;
  background: transparent;
}
.thread::before,
.thread::after { content: none; display: none; }
.messages {
  position: relative; z-index: 1;
  flex: 1; min-height: 0; overflow-y: auto; padding: 8px 0 20px;
  background: transparent;
}
html[data-wallpaper="custom"] .thread {
  background: transparent;
}
html[data-wallpaper="custom"] .thread::before,
html[data-wallpaper="custom"] .thread::after {
  content: none;
  display: none;
}
.jump {
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); z-index: 2;
  background: var(--sidebar); color: #fff; border: none; border-radius: 16px; padding: 6px 12px;
  font-size: 13px; box-shadow: 0 4px 12px rgba(0,0,0,.2);
}
/* Header and composer overlay the message list so backdrop-filter samples bubbles,
   not only the wallpaper behind a flex sibling. */
html.chat-chrome-overlay .main {
  --chat-banner-h: 0px;
  --chat-pin-top: 76px;
  --chat-overlay-top: 64px;
  --chat-overlay-bottom: 48px;
  --chat-scroll-top: 76px;
  --chat-scroll-bottom: 96px;
}
html.chat-chrome-overlay .main > .banner:not(.hidden) {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  margin: 0;
  z-index: 14;
}
html.chat-chrome-overlay .main > .channel-header {
  position: absolute;
  top: calc(8px + var(--chat-banner-h, 0px));
  left: 12px;
  right: 12px;
  margin: 0;
  z-index: 12;
}
html.chat-chrome-overlay .main > .pinned-banner:not(.hidden) {
  position: absolute;
  top: var(--chat-pin-top, 76px);
  left: 12px;
  right: 12px;
  margin: 0;
  z-index: 11;
}
html.chat-chrome-overlay .main > .composer-wrap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: auto;
  margin: 0;
  z-index: 4;
}
html.chat-chrome-overlay .main > .thread {
  position: absolute;
  inset: 0;
  z-index: 1;
}
html.chat-chrome-overlay .thread > .messages {
  position: absolute;
  inset: 0;
  padding-top: var(--chat-overlay-top, 64px);
  padding-bottom: var(--chat-overlay-bottom, 48px);
  scroll-padding-top: var(--chat-scroll-top, 76px);
  scroll-padding-bottom: var(--chat-scroll-bottom, 96px);
}
html.chat-chrome-overlay .thread > .typing {
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--chat-scroll-bottom, 96px);
  z-index: 2;
  margin: 0;
}
html.chat-chrome-overlay .thread > .jump {
  bottom: calc(8px + var(--chat-scroll-bottom, 96px));
}
.empty-thread { color: var(--on-wallpaper-muted, #3a4150); padding: 32px 20px; font-size: calc(15px * var(--text-scale, 1)); }

/* Notification center: same floating card as a dialogue, under the header. */
#notif-center.notif-center {
  display: none;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 8;
  box-sizing: border-box;
  margin: 0;
  padding:
    calc(var(--chat-scroll-top, 76px) + 12px)
    12px
    calc(var(--chat-overlay-bottom, 48px) + 8px);
  background: transparent;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  overflow: hidden;
  pointer-events: none;
}
#notif-center.notif-center:not(.hidden) {
  display: flex !important;
}
.notif-center-card {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  width: min(720px, 100%);
  max-height: 100%;
  margin: 0 auto;
  padding: 8px 18px 14px;
  overflow: hidden;
  border-radius: 16px;
  box-shadow: 0 12px 36px rgba(16, 24, 40, .18);
}
.notif-center-head {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
  min-width: 0;
}
.notif-center-head > .feature-back { margin: 0 0 0 -8px; }
.notif-center-card > h1 {
  margin: 0;
  font-size: calc(22px * var(--text-scale, 1));
  line-height: 1.2;
}
.notif-center-tabs {
  display: flex;
  gap: 8px;
  flex: none;
  margin: 12px 0 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.notif-center-tabs::-webkit-scrollbar { display: none; }
.notif-center-tab {
  appearance: none;
  border: 1px solid #e4e7ec;
  background: #fff;
  color: #5c6270;
  font: inherit;
  font-size: calc(14px * var(--text-scale, 1));
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  flex: none;
}
.notif-center-tab:hover { background: #fff; }
.notif-center-tab.is-active {
  background: #fff;
  color: #1a1d26;
  font-weight: 700;
  border-color: #b7bcc6;
}
.notif-center-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 8px;
}
.notif-center-empty {
  border: 1px dashed #d0d4dc;
  border-radius: 12px;
  padding: 28px 16px;
  text-align: center;
  color: #8b8e98;
  font-size: calc(14px * var(--text-scale, 1));
  background: #fafbfc;
  margin: 4px 0;
}
.notif-center-day {
  display: flex;
  justify-content: center;
  margin: 4px 0 2px;
}
.notif-center-day span {
  background: #fff;
  border: 1px solid #e6e8ee;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: calc(12px * var(--text-scale, 1));
  font-weight: 650;
  color: #3f4350;
}
.notif-center-item {
  position: relative;
  width: 100%;
  border: 1px solid #eceef3;
  background: rgba(255, 255, 255, .92);
  border-radius: 14px;
  color: #1a1d26;
}
.notif-center-item-main {
  appearance: none;
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 14px;
  padding: 10px 36px 10px 12px;
  text-align: left;
  cursor: pointer;
  color: inherit;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}
.notif-center-item-main:hover { background: #fff; }
.notif-center-dismiss {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: #e23b3b;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.notif-center-dismiss:hover { color: #b42318; }
.notif-center-star {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 28px; height: 28px; padding: 0; border: 0; background: transparent; cursor: pointer;
  display: grid; place-items: center; color: #b9bec9; border-radius: 50%;
  transition: color .12s ease, transform .12s ease;
}
.notif-center-star:hover { color: #9aa1b0; }
.notif-center-star.is-on { color: #f5b301; }
.notif-center-star:active { transform: scale(.88); }
.notif-center-item.is-invite .notif-center-item-main {
  padding-right: 84px;
  cursor: default;
}
.notif-center-item.is-invite .notif-center-item-main:hover { background: transparent; }
.notif-center-invite-actions {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.notif-center-invite-btn {
  appearance: none;
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  background: #f4f6fa;
  color: #3f4350;
}
.notif-center-invite-btn svg { display: block; }
.notif-center-invite-btn.is-approve {
  color: #0f7a3a;
  background: rgba(15, 122, 58, 0.1);
  border-color: rgba(15, 122, 58, 0.22);
}
.notif-center-invite-btn.is-approve:hover {
  background: rgba(15, 122, 58, 0.18);
}
.notif-center-invite-btn.is-reject {
  color: #b42318;
  background: rgba(180, 35, 24, 0.08);
  border-color: rgba(180, 35, 24, 0.2);
}
.notif-center-invite-btn.is-reject:hover {
  background: rgba(180, 35, 24, 0.16);
}
.notif-center-foot {
  flex: none;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
  margin: 10px 0 0;
  padding: 0;
}
.notif-center-foot[hidden] { display: none !important; }
.notif-center-clear,
.notif-center-read-all {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(180, 186, 198, 0.55);
  background: var(--glass-tools-bg, #fff);
  color: #1a1d26;
  border-radius: 999px;
  padding: 8px 16px;
  font: inherit;
  font-size: calc(14px * var(--text-scale, 1));
  font-weight: 650;
  cursor: pointer;
}
.notif-center-clear svg,
.notif-center-read-all svg { display: block; flex: none; }
.notif-center-item.is-unread { box-shadow: inset 3px 0 0 var(--accent, #1c58d9); }
.notif-center-avatar {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  overflow: hidden;
}
.notif-center-avatar.avatar,
.notif-center-avatar .avatar {
  width: 40px;
  height: 40px;
  border-radius: 8px;
}
.notif-center-avatar.is-mail {
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  user-select: none;
}
.notif-center-item.is-mail .notif-center-item-where {
  color: #3b6fd8;
}
.notif-center-item-body {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.notif-center-item-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.notif-center-item-who {
  font-size: calc(15px * var(--text-scale, 1));
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notif-center-item-time {
  flex: none;
  font-size: calc(12px * var(--text-scale, 1));
  color: #8b8e98;
}
.notif-center-item-where {
  font-size: calc(13px * var(--text-scale, 1));
  color: #6b7080;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notif-center-item-text {
  margin: 2px 0 0;
  font-size: calc(14px * var(--text-scale, 1));
  line-height: 1.35;
  color: #1a1d26;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.notif-center-reacts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.notif-center-react {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f4f6f8;
  border: 1px solid #e6e8ee;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: calc(13px * var(--text-scale, 1));
  color: #3f4350;
}

/* Mail letter/compose — centered white card over the list. */
#mail-dialog-overlay.mail-dialog-overlay {
  display: none;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 9;
  box-sizing: border-box;
  margin: 0;
  padding:
    calc(var(--chat-scroll-top, 76px) + 12px)
    12px
    calc(8px + env(safe-area-inset-bottom, 0px));
  background: transparent;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  overflow: hidden;
  pointer-events: none;
}
#mail-dialog-overlay.mail-dialog-overlay:not(.hidden) {
  display: flex !important;
  pointer-events: auto;
  cursor: default;
}
.mail-dialog-card {
  pointer-events: auto;
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(800px, 100%);
  max-width: 800px;
  max-height: 100%;
  flex: 0 1 auto;
  margin: 0 auto;
  overflow: hidden;
  box-sizing: border-box;
  border-radius: 16px;
  background: #fff;
  border: 1px solid #e8eaef;
  box-shadow: 0 12px 36px rgba(16, 24, 40, 0.18);
}
/* Letter body: a bit wider than two thirds, same height cap. */
#mail-dialog-overlay:not(.is-fullscreen):has(.mail-read--dialog) .mail-dialog-card {
  width: min(680px, 82%);
  max-width: min(680px, 82%);
  max-height: 66.666%;
}
#mail-dialog-overlay:not(.is-fullscreen) .mail-dialog-card.is-user-sized {
  position: absolute;
  margin: 0;
  max-width: none;
  max-height: none;
  left: var(--mail-dlg-l, 0px);
  top: var(--mail-dlg-t, 0px);
}
.mail-dialog-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0 0 16px 0;
  background: transparent;
  cursor: nwse-resize;
  z-index: 3;
  touch-action: none;
  overflow: hidden;
}
.mail-dialog-resize::before {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 26px;
  height: 26px;
  background: linear-gradient(
    135deg,
    transparent 0 46%,
    rgba(40, 48, 64, 0.22) 46% 50%,
    #f7f9fc 50%,
    #e3e8f1 100%
  );
  filter: drop-shadow(-2px -2px 1.5px rgba(16, 24, 40, 0.16));
  pointer-events: none;
}
#mail-dialog-overlay.is-fullscreen .mail-dialog-resize {
  display: none;
}
.app.mail-composer-hidden .composer-wrap {
  display: none !important;
}
.app.mail-dialog-open #mail-dialog-overlay.mail-dialog-overlay {
  padding-bottom: calc(var(--chat-scroll-bottom, 96px) + 8px);
}
#mail-dialog-overlay.is-fullscreen .mail-dialog-card {
  width: 100%;
  max-width: none;
  flex: 1 1 auto;
  height: 100%;
  max-height: 100%;
  border-radius: 12px;
}
.mail-dialog-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  min-width: 0;
  padding: 6px 10px;
  border-bottom: 1px solid #eef0f4;
  background: #fff;
}
.mail-dialog-back,
.mail-dialog-fs {
  flex: none;
  width: var(--chrome-icon-btn, 36px);
  height: var(--chrome-icon-btn, 36px);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #2a2d35;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.mail-dialog-back:hover,
.mail-dialog-fs:hover {
  background: rgba(0, 0, 0, 0.05);
}
.mail-dialog-fs .mail-dialog-fs-collapse { display: none; }
#mail-dialog-overlay.is-fullscreen .mail-dialog-fs .mail-dialog-fs-expand { display: none; }
#mail-dialog-overlay.is-fullscreen .mail-dialog-fs .mail-dialog-fs-collapse { display: block; }
.mail-dialog-head-text {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.mail-dialog-head-text > h1 {
  margin: 0;
  font-size: calc(15px * var(--text-scale, 1));
  font-weight: 700;
  color: #1a1d26;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mail-dialog-head-text > .feature-lead {
  margin: 0;
  color: #6b7080;
  font-size: calc(12px * var(--text-scale, 1));
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mail-dialog-head-text > .feature-lead.hidden {
  display: none !important;
}
.mail-dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: #fff;
}
.mail-read--dialog,
.mail-compose--dialog {
  display: flex;
  flex-direction: column;
  background: transparent;
  border: 0;
  box-shadow: none;
  max-width: none;
  border-radius: 0;
}
.mail-read--dialog {
  gap: 0;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  padding: 0;
  overflow: hidden;
}
.mail-read-actions-card {
  flex: none;
  margin: 0;
  padding: 8px 12px;
  border-radius: 0;
  background: #fafbfc;
  border: 0;
  border-bottom: 1px solid #eef0f4;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.mail-dialog-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.mail-letter {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 16px 18px 20px;
  border-radius: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.mail-letter-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 0 0 14px;
  border-bottom: 1px solid #eef0f4;
}
.mail-letter-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .02em;
  flex: none;
  user-select: none;
}
.mail-letter-head-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mail-letter-from {
  font-weight: 700;
  font-size: calc(15px * var(--text-scale, 1));
  color: #1a1d26;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mail-letter-addr,
.mail-letter-meta {
  font-size: calc(12px * var(--text-scale, 1));
  color: #6b7080;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mail-letter-body {
  min-width: 0;
  border-radius: 0;
  background: #fff;
  overflow: hidden;
}
.mail-letter-body .mail-html-frame {
  display: block;
  width: 100%;
  min-height: 180px;
  border: 0;
  border-radius: 0;
  background: #fff;
}
.mail-letter-body .mail-text {
  border: 0;
  background: transparent;
  padding: 4px 2px 2px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
  font-size: calc(14px * var(--text-scale, 1));
  line-height: 1.5;
  color: #1a1d26;
}
.mail-compose--dialog {
  width: 100%;
  max-width: none;
  align-self: stretch;
  margin: 0;
  flex: 0 1 auto;
  min-height: 0;
  height: auto;
  max-height: 100%;
  padding: 10px 14px 12px;
  gap: 8px;
  overflow: auto;
  border-radius: 0;
  background: #fff;
  border: 0;
  box-shadow: none;
  box-sizing: border-box;
}
.mail-compose--dialog .mail-compose-field {
  gap: 4px;
}
.mail-compose--dialog .mail-compose-field > span {
  font-size: calc(12px * var(--text-scale, 1));
}
.mail-compose--dialog .mail-compose-field input,
.mail-compose--dialog .mail-compose-field select,
.mail-compose--dialog .mail-compose-field textarea {
  padding: 7px 10px;
  font-size: calc(14px * var(--text-scale, 1));
  border-radius: 8px;
}
.mail-compose--dialog .mail-compose-field--body textarea {
  min-height: 108px;
  height: 108px;
  flex: none;
  resize: vertical;
}
.mail-compose--dialog .mail-compose-send.btn.primary {
  min-height: 32px;
  padding: 0 14px;
  border-radius: 8px;
}
#mail-dialog-overlay:has(.mail-compose--dialog):not(.is-fullscreen) .mail-dialog-card {
  flex: 0 1 auto;
  height: auto;
  max-height: 100%;
}
.app.mail-dialog-open.mail-mode #feature-screen {
  pointer-events: none;
}
.app.mail-dialog-open.mail-mode #feature-screen .mail-manage-card,
.app.mail-dialog-open.mail-mode #feature-screen .mail-list {
  opacity: 0.4;
  filter: saturate(0.8);
}

/* Dialogue: floating card under header (I), capped above composer (II). No dim. */
#dialogue-overlay.dialogue-overlay {
  display: none;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 8;
  box-sizing: border-box;
  margin: 0;
  padding:
    calc(var(--chat-scroll-top, 76px) + 12px)
    12px
    calc(var(--chat-overlay-bottom, 48px) + 8px);
  background: transparent;
  justify-content: center;
  align-items: flex-start;
  overflow: hidden;
  pointer-events: none;
}
#dialogue-overlay.dialogue-overlay:not(.hidden) {
  display: flex !important;
}
.dialogue-card {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  width: min(720px, 100%);
  max-height: 100%;
  margin: 0 auto;
  padding: 8px 18px 14px;
  overflow: hidden;
  border-radius: 16px;
  box-shadow: 0 12px 36px rgba(16, 24, 40, .18);
}
.dialogue-card > .feature-back {
  margin: 0 0 2px 0;
  flex: none;
}
.dialogue-card > h1,
.dialogue-card > .feature-lead {
  flex: none;
}
.dialogue-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  border: 1px solid #e8eaef;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.55);
}
.dialogue-root-slot {
  flex: none;
  padding: 10px 12px 8px;
  border-bottom: 1px solid #e8eaef;
  background: rgba(248, 249, 251, 0.9);
  max-height: 40%;
  overflow: auto;
}
.dialogue-root-slot .msg { margin: 0; }
/* Root message under discussion — distinct from reply bubbles. */
.dialogue-root-slot .msg.is-dialogue-root .msg-bubble,
.dialogue-root-slot .msg.is-dialogue-root.mine .msg-bubble,
.dialogue-root-slot .msg.is-dialogue-root:not(.mine) .msg-bubble {
  background: #efe8dc;
  color: #1a1d26;
  box-shadow: inset 0 0 0 1px rgba(120, 90, 40, 0.14);
}
.dialogue-root-slot .msg.is-dialogue-root.task-only .msg-bubble,
.dialogue-root-slot .msg.is-dialogue-root.poll-only .msg-bubble,
.dialogue-root-slot .msg.is-dialogue-root.image-only .msg-bubble,
.dialogue-root-slot .msg.is-dialogue-root.emoji-only .msg-bubble,
.dialogue-root-slot .msg.is-dialogue-root.video-note-only .msg-bubble {
  background: transparent;
  box-shadow: none;
}
.dialogue-messages {
  flex: 1 1 auto;
  min-height: 80px;
  overflow: auto;
  padding: 10px 12px 12px;
  -webkit-overflow-scrolling: touch;
}
.dialogue-messages .dialogue-empty {
  border: 1px dashed #d0d4dc;
  border-radius: 12px;
  padding: 28px 16px;
  text-align: center;
  color: #8b8e98;
  font-size: calc(14px * var(--text-scale, 1));
  background: #fafbfc;
  margin: 4px 0;
}
.channel-card-dialogues-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 8px;
}
.channel-card-dialogues-head .channel-card-section-label { margin: 0; }
.channel-card-dialogues-tools {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: none;
}
.channel-dialogues-tool-btn {
  appearance: none; border: 0; background: transparent;
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center; padding: 0;
  color: #5c6270; cursor: pointer;
}
.channel-dialogues-tool-btn:hover { background: #f2f4f8; color: #1a1d26; }
.channel-dialogues-chevron svg {
  transition: transform .15s ease;
}
.channel-dialogues-chevron.is-open svg {
  transform: rotate(90deg);
}
.channel-dialogues-search-btn { display: none; }
.channel-dialogues-search-input {
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 8px;
  border: 1px solid #e4e7ec;
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  font-size: calc(14px * var(--text-scale, 1));
  background: #fff;
  color: #1a1d26;
}
.channel-dialogues-search-input.hidden { display: none !important; }
.channel-card-dialogues {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 16px;
}
.channel-card-dialogues.is-collapsed,
.channel-card-dialogues[hidden] { display: none !important; }
.channel-card-dialogue {
  appearance: none; border: 1px solid #e8eaef; background: #fff;
  border-radius: 12px; padding: 10px 12px; text-align: left;
  cursor: pointer; font: inherit; color: inherit;
  display: flex; flex-direction: column; gap: 4px;
}
.channel-card-dialogue:hover { background: #f7f8fa; }
.channel-card-dialogue-preview {
  font-size: calc(14px * var(--text-scale, 1));
  color: #1a1d26;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.channel-card-dialogue-meta {
  font-size: calc(12px * var(--text-scale, 1));
  color: #8b8e98;
}
.channel-card-dialogues-empty {
  border: 1px dashed #d0d4dc; border-radius: 12px; padding: 16px;
  text-align: center; color: #8b8e98; font-size: calc(13px * var(--text-scale, 1));
}
@media (max-width: 800px) {
  .channel-dialogues-search-btn { display: grid; }
}
.msg-dialogue-badge {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  padding: 2px 7px;
  border: 0;
  border-radius: 10px;
  background:
    color-mix(
      in srgb,
      color-mix(in srgb, var(--pill-color, #1a1d26) 28%, #1a1d26)
      calc(var(--pill-opacity, 0.55) * 100%),
      transparent
    );
  color: #fff;
  font: inherit;
  font-size: calc(11px * var(--text-scale, 1));
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
}
.msg-dialogue-badge:hover,
.msg-dialogue-badge:focus-visible {
  background:
    color-mix(
      in srgb,
      color-mix(in srgb, var(--pill-color, #1a1d26) 28%, #1a1d26)
      calc(min(1, var(--pill-opacity, 0.55) + 0.12) * 100%),
      transparent
    );
  color: #fff;
  outline: none;
}
.msg-dialogue-badge svg {
  width: 12px;
  height: 12px;
  flex: none;
  color: inherit;
}
.intro { padding: 28px 20px 12px; }
.intro h1 {
  font-size: calc(22px * var(--text-scale, 1)); margin: 0 0 8px; color: var(--on-wallpaper-text, #1a1d26);
  text-shadow: 0 1px 0 var(--on-wallpaper-glow, rgba(255,255,255,.7));
}
.intro p {
  margin: 0; max-width: 640px; color: var(--on-wallpaper-muted, #3a4150);
  font-size: calc(14px * var(--text-scale, 1));
  display: inline-block; padding: 6px 10px; border-radius: 8px;
  background: var(--on-wallpaper-chip, rgba(255,255,255,.72));
  box-shadow: 0 1px 1px rgba(16,24,40,.04);
}
.day {
  display: flex; align-items: center; gap: 12px; margin: 12px 20px;
  color: var(--on-wallpaper-muted, #3a4150);
  font-size: calc(12px * var(--text-scale, 1)); font-weight: 700;
}
.day-label {
  padding: 3px 10px; border-radius: 999px;
  background: var(--on-wallpaper-chip, rgba(255,255,255,.78));
  box-shadow: 0 1px 1px rgba(16,24,40,.04);
}
.day::before, .day::after { content: ""; height: 1px; background: var(--on-wallpaper-line, rgba(26,29,38,.18)); flex: 1; }
.msg {
  display: flex; gap: 8px; padding: 8px 16px 4px; position: relative;
  align-items: flex-end; max-width: 100%;
}
.msg.mine { flex-direction: row-reverse; }
.msg:hover { background: transparent; }
.msg.compact { padding-top: 4px; padding-bottom: 4px; }
.msg.mentions-me .msg-bubble { box-shadow: inset 3px 0 0 #f5a623; }
.msg-avatar-slot {
  width: 36px; min-width: 36px; max-width: 36px; flex: 0 0 36px; align-self: flex-end;
  overflow: visible;
  /* Keep avatar against bubble bottom, not the meta row below it. */
  margin-bottom: 26px;
}
.msg.compact .msg-avatar-slot { visibility: hidden; }
.msg.emoji-only .msg-avatar-slot,
.msg.video-note-only .msg-avatar-slot {
  margin-bottom: 0;
}
.msg-main {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  max-width: min(78%, 560px);
  min-width: 64px;
}
.msg.task-only .msg-main {
  max-width: min(92%, 440px);
}
.msg.poll-only .msg-main {
  /* Wide poll card by default; grow later only if content needs it. */
  width: min(92%, 380px);
  max-width: min(92%, 560px);
  min-width: min(92%, 320px);
}
.msg.emoji-only .msg-main {
  max-width: min(90%, 420px);
  min-width: 0;
}
.msg.video-note-only .msg-main {
  max-width: none;
  min-width: 0;
}
.msg.image-only .msg-main {
  max-width: min(78%, 560px);
  min-width: 0;
}
.msg-bubble {
  max-width: 100%; min-width: 0;
  padding: 8px 10px 6px; border-radius: 14px;
  background: #ffffff;
  color: var(--bubble-peer-text, #1a1d26);
  box-shadow: 0 1px 1px rgba(16, 24, 40, .08);
}
.msg.mine .msg-bubble {
  background: var(--bubble-color, #ffffff);
  color: var(--bubble-text, #1a1d26);
  border-bottom-right-radius: 4px;
}
.msg:not(.mine) .msg-bubble {
  border-bottom-left-radius: 4px;
  background: #ffffff;
  color: var(--bubble-peer-text, #1a1d26);
}
/* Card / media messages: keep bubble chrome transparent (must follow base .msg-bubble). */
.msg.task-only .msg-bubble,
.msg.poll-only .msg-bubble,
.msg.image-only .msg-bubble,
.msg.emoji-only .msg-bubble,
.msg.video-note-only .msg-bubble,
.msg.mine.task-only .msg-bubble,
.msg.mine.poll-only .msg-bubble,
.msg.mine.image-only .msg-bubble,
.msg.mine.emoji-only .msg-bubble,
.msg.mine.video-note-only .msg-bubble,
.msg:not(.mine).task-only .msg-bubble,
.msg:not(.mine).poll-only .msg-bubble,
.msg:not(.mine).image-only .msg-bubble,
.msg:not(.mine).emoji-only .msg-bubble,
.msg:not(.mine).video-note-only .msg-bubble {
  background: transparent;
  box-shadow: none;
}
.msg.task-only .msg-bubble,
.msg.poll-only .msg-bubble {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  max-width: 100%;
  min-width: 0;
  padding: 0;
  position: relative;
  color: #1a1d26;
}
.msg.mine.task-only .msg-bubble,
.msg.mine.poll-only .msg-bubble {
  align-items: flex-end;
}
.msg.task-only:not(.mine) .msg-bubble,
.msg.poll-only:not(.mine) .msg-bubble {
  align-items: flex-start;
}
.msg.task-only .msg-body,
.msg.poll-only .msg-body {
  width: 100%;
}
.msg-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.msg-meta:not(:has(.msg-reactions)) {
  justify-content: flex-end;
}
.msg:not(.mine) .msg-meta:not(:has(.msg-reactions)) {
  justify-content: flex-start;
}
.msg .msg-reactions {
  flex: 1 1 auto;
  justify-content: flex-start;
}
.msg.mine .msg-meta {
  justify-content: space-between;
}
.msg.mine .msg-meta:not(:has(.msg-reactions)) {
  justify-content: flex-end;
}
.msg-reactions {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin: 0;
  max-width: calc(100% - 72px);
  min-width: 0;
  flex: 1 1 auto;
  align-items: center;
  justify-content: flex-start;
}
.msg-reaction {
  appearance: none; border: 1px solid rgba(16, 24, 40, .08);
  background: rgba(255, 255, 255, .92);
  border-radius: 999px;
  padding: 2px 8px 2px 6px;
  display: inline-flex; align-items: center; gap: 4px;
  cursor: pointer; line-height: 1.2;
  box-shadow: 0 1px 1px rgba(16, 24, 40, .04);
}
.msg-reaction:hover { background: #fff; border-color: rgba(16, 24, 40, .16); }
.msg-reaction.is-mine {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--accent-soft);
}
.msg-reaction-emoji {
  display: inline-flex;
  align-items: center;
  font-size: 15px;
  line-height: 1;
}
.msg-reaction-emoji img.icq-smiley {
  width: 18px;
  height: 18px;
}
.msg-reaction-count {
  font-size: 12px; font-weight: 400; color: #5c6270; min-width: 0.6em;
}
.msg-reaction.is-mine .msg-reaction-count { color: var(--accent); }
.msg-reaction-add {
  min-width: 26px;
  justify-content: center;
  color: #7a8494;
  font-weight: 700;
}
.emoji-picker.reaction-mode .emoji-picker-tab[data-group="icq"] { display: none; }
.emoji-picker.reaction-mode {
  position: fixed;
  z-index: 95;
  right: auto;
  bottom: auto;
}
.msg.emoji-only .msg-avatar-slot { width: 0; min-width: 0; max-width: 0; flex: 0 0 0; }
.msg.emoji-only .msg-bubble {
  background: transparent; box-shadow: none; color: inherit;
  min-width: 0; max-width: 100%;
  padding: 0; border-radius: 0;
}
.msg.emoji-only .msg-body {
  font-size: 54px; line-height: 1.05; white-space: pre-wrap;
  letter-spacing: 2px; user-select: text;
  -webkit-text-size-adjust: 100%;
}
.msg.emoji-only.emoji-2 .msg-body { font-size: 44px; }
.msg.emoji-only.emoji-3 .msg-body { font-size: 36px; letter-spacing: 1px; }
.msg.emoji-only .msg-receipt {
  --receipt-muted: rgba(255, 255, 255, .4);
  --receipt-blue: #fff;
}
.msg.emoji-only .msg-receipt.is-sent .msg-receipt-chev { color: var(--receipt-muted); }
.msg.emoji-only .msg-receipt.is-delivered .msg-receipt-chev:first-child { color: var(--receipt-blue); }
.msg.emoji-only .msg-receipt.is-delivered .msg-receipt-chev:last-child { color: var(--receipt-muted); }
.msg.emoji-only .msg-receipt.is-read .msg-receipt-chev { color: var(--receipt-blue); }
.msg.emoji-only.mentions-me .msg-bubble { box-shadow: none; }
.msg.video-note-only .msg-avatar-slot { width: 0; min-width: 0; max-width: 0; flex: 0 0 0; }
.msg.video-note-only .msg-bubble {
  background: transparent; box-shadow: none; color: inherit;
  min-width: 0; max-width: 100%;
  padding: 0; border-radius: 0;
}
.msg.video-note-only .msg-body { margin: 0; padding: 0; }
.msg.video-note-only .msg-video-note {
  margin: 0;
  box-shadow: 0 2px 10px rgba(16, 24, 40, .18);
}
.msg.video-note-only .msg-receipt {
  --receipt-muted: rgba(255, 255, 255, .4);
  --receipt-blue: #fff;
}
.msg.video-note-only .msg-receipt.is-sent .msg-receipt-chev { color: var(--receipt-muted); }
.msg.video-note-only .msg-receipt.is-delivered .msg-receipt-chev:first-child { color: var(--receipt-blue); }
.msg.video-note-only .msg-receipt.is-delivered .msg-receipt-chev:last-child { color: var(--receipt-muted); }
.msg.video-note-only .msg-receipt.is-read .msg-receipt-chev { color: var(--receipt-blue); }
.msg.video-note-only.mentions-me .msg-bubble { box-shadow: none; }
.msg.video-note-only .msg-video-note-dur { bottom: 10px; }
.msg-head { display: flex; gap: 8px; align-items: baseline; margin: 0 0 2px; }
.msg.compact .msg-head { display: none; }
.msg.mine .msg-head { justify-content: flex-end; }
.msg-name {
  appearance: none; border: 0; background: transparent; padding: 0; cursor: pointer;
  font-weight: 700; font-size: calc(14px * var(--text-scale, 1)); color: inherit; font-family: inherit;
}
.msg-name:hover { text-decoration: underline; }
.msg-name.is-you {
  cursor: default;
  font-weight: 650;
  opacity: 0.72;
  text-decoration: none;
}
.msg-name.is-you:hover { text-decoration: none; }
#dialogue-overlay .msg.compact .msg-head { display: flex; }
.avatar.is-clickable { cursor: pointer; }
.avatar.is-clickable:hover { box-shadow: 0 0 0 2px var(--accent-soft); }
.msg-body { font-size: calc(15px * var(--text-scale, 1)); line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; color: inherit; }
.msg-body.msg-e2e-locked { color: #8b8e98; font-style: italic; }
.msg-foot {
  display: inline-flex; justify-content: center; align-items: center; gap: 4px;
  margin: 0; margin-right: auto; flex: none;
  min-height: 0;
  /* Same dark pill as image / emoji / task messages: white »» = read. */
  padding: 2px 7px;
  border-radius: 10px;
  background:
    color-mix(
      in srgb,
      color-mix(in srgb, var(--pill-color, #1a1d26) 28%, #1a1d26)
      calc(var(--pill-opacity, 0.55) * 100%),
      transparent
    );
  pointer-events: none;
}
.msg.mine .msg-foot {
  margin-left: auto;
  margin-right: 0;
}
.msg-time {
  color: #fff;
  font-size: calc(11px * var(--text-scale, 1));
  line-height: 1;
  font-weight: 600;
}
.msg.mine .msg-time { color: #fff; }
.msg-receipt {
  display: inline-flex; align-items: center; justify-content: center;
  height: 12px; flex: none; margin-left: 3px; gap: 0;
  --receipt-muted: rgba(255, 255, 255, .4);
  --receipt-blue: #fff;
}
.msg-receipt-chev { width: 9px; height: 12px; display: block; margin-left: -3px; }
.msg-receipt-chev:first-child { margin-left: 0; }
.msg-receipt.is-sent .msg-receipt-chev { color: var(--receipt-muted); }
.msg-receipt.is-delivered .msg-receipt-chev:first-child { color: var(--receipt-blue); }
.msg-receipt.is-delivered .msg-receipt-chev:last-child { color: var(--receipt-muted); }
.msg-receipt.is-read .msg-receipt-chev { color: var(--receipt-blue); }
.msg-meta:empty { display: none; }
.msg-edited {
  color: #fff;
  font-size: calc(11px * var(--text-scale, 1));
  margin-right: 4px;
  font-weight: 500;
}
.msg.mine .msg-edited { color: #fff; }
.msg.image-only .msg-time,
.msg.image-only .msg-edited,
.msg.mine.image-only .msg-time,
.msg.mine.image-only .msg-edited,
.msg.emoji-only .msg-time,
.msg.emoji-only .msg-edited,
.msg.mine.emoji-only .msg-time,
.msg.mine.emoji-only .msg-edited,
.msg.video-note-only .msg-time,
.msg.video-note-only .msg-edited,
.msg.mine.video-note-only .msg-time,
.msg.mine.video-note-only .msg-edited {
  color: #fff;
}
.msg-reply {
  display: flex; gap: 8px; margin: 0 0 4px; padding: 4px 8px;
  border-left: 3px solid var(--accent); background: rgba(0,0,0,.04); border-radius: 4px;
  cursor: pointer; max-width: 100%;
}
.msg.mine .msg-reply { background: rgba(255,255,255,.35); }
.msg-reply-name { color: var(--accent); font-size: calc(12px * var(--text-scale, 1)); font-weight: 700; }
.msg-reply-body { color: #6b7080; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg.selecting { cursor: pointer; }
.msg.selected-msg { background: transparent; }
.msg-check {
  width: 22px; height: 22px; min-width: 22px; border-radius: 50%;
  border: 2px solid #d5d8de;
  display: grid; place-items: center; margin: 8px 4px 0; flex: none;
  color: transparent; background: #fff;
  font-size: 13px; font-weight: 700; line-height: 1;
}
.msg.selected-msg .msg-check {
  background: #d7dbe3;
  border-color: #d7dbe3;
  color: var(--accent, #1c58d9);
}
.msg-body code {
  background: rgba(0,0,0,.06); border-radius: 3px; padding: 1px 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em;
}
.msg-body a {
  color: var(--accent);
  text-decoration: none;
}
.msg-body a:hover {
  text-decoration: none;
}
.mention { background: var(--mention-bg); color: var(--accent); border-radius: 3px; padding: 0 3px; }
.mention.me { background: #ffe8e8; color: #c43133; font-weight: 700; }

.avatar {
  width: 36px; height: 36px; min-width: 36px; min-height: 36px; max-width: 36px; max-height: 36px;
  aspect-ratio: 1 / 1; border-radius: 50%; color: #fff;
  font-weight: 700; font-size: 14px; position: relative; flex: 0 0 36px; align-self: flex-start;
  user-select: none; overflow: visible; display: block;
  background-color: var(--avatar-bg, #7939f2);
}
.avatar img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover; object-position: center; display: block;
  border-radius: inherit;
}
.avatar .presence {
  position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%;
  background: #3db887; border: 1px solid #fff; z-index: 2; box-sizing: border-box;
  pointer-events: none;
}
.avatar .presence::before,
.avatar .presence::after { content: none !important; display: none !important; }
.avatar .presence.away { background: #f5a623; }
.avatar .presence.dnd { background: #d24b4e; }
.avatar .presence.offline { background: #a0a4b0; border-color: #fff; }
.av-0 { background: var(--accent); } .nc-0 { color: var(--accent); }
.av-1 { background: #3db887; } .nc-1 { color: #1c8f68; }
.av-2 { background: #d24b4e; } .nc-2 { color: #d24b4e; }
.av-3 { background: #e0941a; } .nc-3 { color: #b67408; }
.av-4 { background: #8f4fbf; } .nc-4 { color: #8f4fbf; }
.av-5 { background: #1f9aaf; } .nc-5 { color: #1f9aaf; }
.av-6 { background: #e05a8a; } .nc-6 { color: #e05a8a; }
.av-7 { background: #5b6ee1; } .nc-7 { color: #5b6ee1; }

.typing { display: none; }
.profile-visit {
  flex: 1; overflow: auto; display: flex; flex-direction: column; align-items: stretch;
  padding: 16px 20px 24px; gap: 4px; min-height: 0;
}
.profile-visit > * { flex-shrink: 0; }
.card-avatar-wrap {
  position: relative;
  width: 140px; height: 140px;
  min-width: 140px; min-height: 140px;
  max-width: 140px; max-height: 140px;
  margin: 4px auto 16px;
  align-self: center;
  flex: 0 0 140px;
  overflow: visible;
}
.profile-visit .avatar {
  position: absolute; inset: 0;
  width: 100% !important; height: 100% !important;
  min-width: 0 !important; min-height: 0 !important;
  max-width: none !important; max-height: none !important;
  aspect-ratio: auto; border-radius: 8px; font-size: 48px; margin: 0;
  cursor: pointer; flex: none !important; overflow: visible; display: block;
  align-self: auto;
}
.profile-visit .avatar img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover; object-position: center;
  border-radius: 8px; display: block;
}
.avatar-clear {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  width: 24px; height: 24px; border: none; border-radius: 50%;
  background: rgba(255,255,255,.92); color: #8b8e98; font-size: 16px; line-height: 1;
  display: grid; place-items: center; cursor: pointer; padding: 0;
  box-shadow: 0 1px 4px rgba(20,28,45,.18);
}
.avatar-clear:hover { color: #5c6270; background: #fff; }
.avatar-clear.hidden { display: none !important; }
.profile-visit .avatar .presence {
  right: 4px; bottom: 4px; width: 18px; height: 18px; border-width: 1.5px;
}
.visit-name {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  width: 100%; position: relative; z-index: 1;
}
.visit-name input {
  flex: 1; min-width: 0; font-size: 22px; font-weight: 700; color: var(--text-strong);
  border: none; border-bottom: 2px solid #d5d8de; border-radius: 0; padding: 0 0 2px; background: transparent;
}
.profile-visit h2 { margin: 0; font-size: 22px; line-height: 1.25; flex: 1; }
.visit-edit {
  width: 32px; height: 32px; border: none; border-radius: 4px; background: none;
  color: var(--accent); display: grid; place-items: center; flex: none; padding: 0;
}
.visit-edit:hover { background: var(--accent-soft); }
.profile-visit #card-role { font-size: 15px; margin-top: 4px; }
.profile-visit #card-handle { color: #6b7080; font-size: 14px; }

.card-presence {
  margin-top: 6px; color: #6b7080; font-size: 14px; line-height: 1.3;
}
.card-presence:empty { display: none; }
.card-presence.is-online { color: #2f9e6b; font-weight: 600; }
.card-contact.hidden { display: none !important; }
.card-contact-ico {
  width: 22px; height: 22px; border-radius: 0; background: transparent;
  color: #1b1d21; display: grid; place-items: center; flex: none;
}
.card-contact-ico svg { display: block; width: 20px; height: 20px; }
.profile-visit.is-other .card-availability { display: none !important; }
.card-availability {
  margin-top: 10px;
  border: var(--glass-border);
  border-radius: 10px;
  overflow: hidden;
  flex: 0 0 auto;
  background: var(--glass-chip-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
}
.card-availability #card-availability-toggle {
  height: 52px;
  min-height: 52px;
  color: #1b1d21;
  font-size: 15px;
  font-weight: 700;
  box-sizing: border-box;
}
.card-availability .user-menu-row { border-top: none; }
.card-availability .availability-list { display: block; }
.card-availability .availability-list.hidden { display: none !important; }
.card-availability .availability-list .user-menu-row {
  border-top: 1px solid #f0f0f0; padding-left: 16px; flex: 0 0 auto; min-height: 44px;
}
.profile-visit #card-status { margin: 8px 0 0; color: #3f4350; font-size: 14px; }
.profile-visit #card-status:empty { display: none; }
.settings-screen {
  position: absolute; inset: 0; z-index: 6; background: #fff; overflow: auto;
  display: flex; justify-content: center;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 20px calc(48px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}
.settings-card { width: min(480px, 100%); padding-bottom: 16px; }
.settings-card:has([data-panel="accounts"]:not(.hidden)) { width: min(760px, 100%); }
.settings-menu { display: none; }
.settings-card h1 { margin: 0 0 8px; font-size: calc(24px * var(--text-scale, 1)); }
.settings-avatar-block {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin: 8px 0 22px;
}
.settings-avatar-wrap {
  position: relative;
  width: 152px;
  height: 152px;
  min-width: 152px;
  min-height: 152px;
  flex: 0 0 152px;
}
.settings-avatar-wrap .avatar {
  width: 152px !important;
  height: 152px !important;
  min-width: 152px !important;
  min-height: 152px !important;
  max-width: 152px !important;
  max-height: 152px !important;
  flex: 0 0 152px !important;
  font-size: 56px;
  border-radius: 14px;
  overflow: hidden;
  align-self: center;
}
.settings-avatar-wrap .avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}
.settings-avatar-wrap .avatar .presence {
  width: 18px;
  height: 18px;
  right: 4px;
  bottom: 4px;
  border-width: 2px;
}
.settings-avatar-edit {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 3;
  width: 34px;
  height: 34px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  color: var(--accent);
  background: rgba(255,255,255,.94);
  box-shadow: 0 1px 4px rgba(20,28,45,.18);
  cursor: pointer;
}
.settings-avatar-edit:hover {
  background: #fff;
}
.settings-avatar-edit svg {
  display: block;
}
.settings-avatar-wrap .avatar-clear {
  top: auto;
  bottom: 6px;
  right: 6px;
  z-index: 3;
}
.settings-panel-head {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 8px;
}
.settings-panel-head > h1 { margin-bottom: 8px; }
.settings-panel-sub {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}
.settings-panel-head .settings-lead { margin-bottom: 0; min-width: 0; flex: 1; }
.for-all-head {
  flex: none;
  width: 64px;
  text-align: center;
  font: inherit;
  font-size: calc(14px * var(--text-scale, 1));
  font-weight: 400;
  color: #6b7080;
  line-height: 1.25;
  white-space: nowrap;
}
.for-all-toggle {
  position: relative;
  flex: none;
  width: 64px;
  display: grid;
  place-items: center;
  margin: 0 !important;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.for-all-toggle-label {
  display: none;
}
.for-all-toggle input[type="checkbox"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: auto;
  height: auto;
  margin: 0;
  cursor: pointer;
  pointer-events: auto;
  z-index: 2;
}
.appearance-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px;
  column-gap: 8px;
  margin-top: 12px;
  align-items: center;
}
.appearance-row-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #e8eaef;
  border-radius: 14px;
  background: #fff;
  box-sizing: border-box;
}
.appearance-row-body > label {
  margin: 0 !important;
  font-size: calc(14px * var(--text-scale, 1));
  font-weight: 700;
  color: #1a1d26;
}
.appearance-row-body > .avatar-style-row,
.appearance-row-body > .avatar-style-stack {
  min-width: 0;
}
@property --for-all-lift {
  syntax: "<length>";
  inherits: true;
  initial-value: 0px;
}
.appearance-row > .for-all-toggle {
  --for-all-lift: calc(1.25em + 10px + (48px - 24px) / 2);
  width: 64px;
  align-self: start;
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  /* Switch lines up with the color cubes; the caption is pulled up to the title. */
  margin: calc(12px + var(--for-all-lift)) 0 0 !important;
  padding: 0;
  min-height: 26px;
}
.appearance-row > .for-all-toggle .for-all-toggle-label {
  display: block;
  position: absolute;
  left: 50%;
  top: calc(-1 * var(--for-all-lift));
  transform: translateX(-50%);
  width: max-content;
  text-align: center;
  font-size: calc(11px * var(--text-scale, 1));
  font-weight: 500;
  color: #6b7080;
  line-height: 1.15;
  white-space: nowrap;
}
.appearance-row-tall > .for-all-toggle {
  align-self: start;
  margin-top: calc(12px + var(--for-all-lift)) !important;
}
.notify-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px;
  column-gap: 8px;
  margin-top: 14px;
  align-items: center;
}
.notify-row .settings-toggle {
  margin: 0 !important;
  width: 100%;
  box-sizing: border-box;
}
.notify-row > .for-all-toggle {
  width: 64px;
  align-self: center;
  justify-self: center;
  display: grid;
  place-items: center;
  margin: 0 !important;
  padding: 0;
  min-height: 26px;
}
.notify-row > .for-all-toggle .settings-toggle-ui {
  width: 44px;
  height: 26px;
}
.notify-row > .for-all-toggle .settings-toggle-ui::after {
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
}
.notify-row > .for-all-toggle input:checked + .settings-toggle-ui::after {
  transform: translateX(18px);
}
.perm-group-title {
  display: block;
  margin: 18px 0 8px;
  font-size: calc(14px * var(--text-scale, 1));
  font-weight: 700;
  color: var(--text-strong, #1a1d26);
  line-height: 1.3;
}
.perm-group-card {
  margin: 0;
  padding: 14px;
  border: 1px solid #ebebeb;
  border-radius: 10px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fff;
}
.plugin-empty {
  margin: 0;
  padding: 8px 2px;
  color: #6b7080;
  font-size: calc(14px * var(--text-scale, 1));
  line-height: 1.4;
}
.plugin-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.plugin-card {
  gap: 14px;
  margin-top: 14px;
}
.plugin-card.hidden { display: none !important; }
.appearance-group-card {
  gap: 14px;
  margin-top: 14px;
}
.appearance-disclose-panel {
  gap: 0;
}
.appearance-disclose-panel .appearance-row:first-child {
  margin-top: 0;
}
.plugin-disclose {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
  box-sizing: border-box;
}
.plugin-disclose-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.plugin-disclose-text strong {
  font-size: calc(16px * var(--text-scale, 1));
  color: var(--text-strong, #1a1d26);
}
.plugin-disclose-hint {
  font-size: calc(13px * var(--text-scale, 1));
  color: #6b7080;
  line-height: 1.35;
}
.plugin-disclose .chevron {
  flex: none;
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  opacity: .55;
  transition: transform .15s ease;
}
.plugin-disclose[aria-expanded="false"] .chevron {
  transform: rotate(-45deg);
}
.plugin-disclose-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f0f1f4;
}
.plugin-disclose-panel.hidden { display: none !important; }

.plugin-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.plugin-card-title strong {
  font-size: calc(16px * var(--text-scale, 1));
  color: var(--text-strong, #1a1d26);
}

.plugin-card-lead {
  margin: 0;
  color: #6b7080;
  font-size: calc(13px * var(--text-scale, 1));
  line-height: 1.4;
}

.plugin-code-box.hidden { display: none !important; }
.settings-card .plugin-card label.settings-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  font-size: calc(13px * var(--text-scale, 1));
  color: #6b7080;
}
.settings-card .plugin-card label.settings-field input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #e2e4ea;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  color: var(--text-strong, #1a1d26);
  background: #fff;
}
.settings-card .plugin-card label.settings-field .password-wrap {
  width: 100%;
}
.settings-card .plugin-card label.settings-field .password-wrap input {
  padding-right: 40px;
}

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

.plugin-card-toggle {
  flex: none;
  margin: 0 !important;
  padding: 0 !important;
  gap: 0 !important;
  width: auto !important;
  min-height: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}
.plugin-card-toggle .settings-toggle-ui {
  margin: 0;
}

.plugin-actions-secondary {
  opacity: 0.95;
}

.settings-card .perm-group-card label.settings-toggle.perm-toggle {
  margin: 0;
  background: #fff;
}
.perm-toggle.is-focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.admin-for-all.hidden { display: none !important; }
.avatar-style-row.compact { gap: 10px; margin-top: 0; flex-wrap: nowrap; }
.wallpaper-preview-actions {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: auto;
  min-width: 0;
}
.wallpaper-preview-actions .btn {
  width: auto;
  min-width: 0;
  box-sizing: border-box;
  white-space: nowrap;
}
.avatar-style-row.compact .avatar-style-preview,
.avatar-style-row.compact .theme-style-preview,
.avatar-style-row.compact .wallpaper-preview,
.avatar-style-row.compact .bubble-preview,
.avatar-style-row.compact .glass-preview {
  width: 48px; height: 48px; min-width: 48px; min-height: 48px; max-width: 48px; max-height: 48px;
  flex: 0 0 48px; border-radius: 12px;
}
.avatar-style-row.compact .avatar-swatches { gap: 6px; }
.avatar-style-row.compact .avatar-swatch,
.avatar-style-row.compact .theme-swatch,
.avatar-style-row.compact .wallpaper-swatch,
.avatar-style-row.compact .bubble-swatch {
  width: 28px; height: 28px;
  padding: 2px;
  border-radius: 8px;
}
.avatar-style-row.compact .wallpaper-actions .btn { padding: 4px 8px; font-size: 12px; }
.avatar-style-stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
}
.avatar-style-stack > .avatar-style-row {
  margin-top: 0;
}
.avatar-opacity-block {
  width: 100%;
  max-width: 220px;
  margin-top: 0;
}
.avatar-opacity-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.avatar-opacity-title {
  font-size: calc(13px * var(--text-scale, 1));
  font-weight: 600;
  color: #5b6472;
}
.avatar-opacity-value {
  font-size: calc(13px * var(--text-scale, 1));
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  min-width: 3.2em;
  text-align: right;
}
.avatar-opacity-slider {
  max-width: 100%;
}
.settings-card .for-all-toggle .settings-toggle-ui {
  width: 40px;
  height: 24px;
  border-radius: 999px;
  background: #d0d4dc;
  position: relative;
  display: block;
  transition: background .15s ease;
}
.settings-card .for-all-toggle .settings-toggle-ui::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(20,28,45,.2);
  transition: transform .15s ease;
}
.settings-card .for-all-toggle input:checked + .settings-toggle-ui {
  background: var(--accent);
}
.settings-card .for-all-toggle input:checked + .settings-toggle-ui::after {
  transform: translateX(16px);
}
.settings-card .notify-row > .for-all-toggle .settings-toggle-ui {
  width: 44px;
  height: 26px;
}
.settings-card .notify-row > .for-all-toggle .settings-toggle-ui::after {
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
}
.settings-card .notify-row > .for-all-toggle input:checked + .settings-toggle-ui::after {
  transform: translateX(18px);
}
.settings-lead { margin: 0 0 8px; color: #6b7080; font-size: calc(14px * var(--text-scale, 1)); }

.ios-homescreen-tip {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  pointer-events: none;
}
.ios-homescreen-tip-inner {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 14px;
  border-radius: 16px;
  background: rgba(20, 33, 61, 0.94);
  color: #fff;
  box-shadow: 0 12px 40px rgba(8, 24, 64, 0.28);
  backdrop-filter: blur(10px);
}
.ios-homescreen-tip-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  flex: 0 0 auto;
}
.ios-homescreen-tip-text {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 2px;
}
.ios-homescreen-tip-text strong {
  font-size: 14px;
  font-weight: 700;
}
.ios-homescreen-tip-text span {
  font-size: 12px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.78);
}
.ios-homescreen-tip-close {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  font: 700 12px/1 system-ui, sans-serif;
  color: #14213d;
  background: #fff;
  flex: 0 0 auto;
}
.ios-homescreen-card {
  margin-top: 18px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px;
  border-radius: 14px;
  background: #eef4ff;
  color: #14213d;
}
.ios-homescreen-card img {
  border-radius: 12px;
  flex: 0 0 auto;
}
.ios-homescreen-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
}
.ios-homescreen-card p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: #5b6b86;
}

.display-size-block {
  margin-top: 0;
  width: 100%;
  max-width: 100%;
}
.display-size-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 0;
}
.display-size-title {
  font-size: calc(14px * var(--text-scale, 1));
  font-weight: 700;
  color: #1a1d26;
  line-height: 1.2;
}
.display-size-value {
  font-size: calc(14px * var(--text-scale, 1));
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.display-size-hint {
  display: block;
  width: 100%;
  margin: 0;
  font-size: calc(12px * var(--text-scale, 1));
  color: #6b7080;
  line-height: 1.35;
}
.display-size-slider {
  display: block;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  max-width: 100%;
  height: 28px;
  margin: 4px 0 0;
  background: transparent;
  cursor: pointer;
}
#ui-scale-slider,
#chrome-icon-slider {
  max-width: 50%;
}
.chrome-icon-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  max-width: 280px;
  margin: 8px 0 4px;
  padding: 8px 10px;
  border-radius: 10px;
  border: var(--glass-border);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-sizing: border-box;
}
.chrome-icon-preview-btn {
  width: var(--chrome-icon-btn);
  height: var(--chrome-icon-btn);
  border-radius: 4px;
  display: grid;
  place-items: center;
  color: #8b8e98;
  flex: none;
}
.chrome-icon-preview-btn svg {
  width: var(--chrome-icon-svg);
  height: var(--chrome-icon-svg);
  display: block;
}
.chrome-icon-preview-btn.is-send {
  color: var(--accent, #1c58d9);
}
.display-size-slider:focus { outline: none; }
.display-size-slider:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);
}
.display-size-slider::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: #e4e7ee;
}
.display-size-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -8px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--accent);
  box-shadow: 0 1px 4px rgba(16, 24, 40, .22);
}
.display-size-slider::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: #e4e7ee;
  border: none;
}
.display-size-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--accent);
  box-shadow: 0 1px 4px rgba(16, 24, 40, .22);
}
.avatar-style-row {
  display: flex; align-items: center; gap: 16px; margin-top: 4px; flex-wrap: wrap;
}
.avatar-style-preview {
  width: 72px; height: 72px; min-width: 72px; min-height: 72px; max-width: 72px; max-height: 72px;
  border-radius: 18px; flex: 0 0 72px;
}
.avatar-style-preview img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.theme-style-preview {
  width: 72px; height: 72px; min-width: 72px; border-radius: 18px; flex: 0 0 72px;
  display: flex; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
.theme-preview-rail { width: 14px; background: var(--rail); flex: none; }
.theme-preview-side {
  flex: 1; background: var(--sidebar); padding: 8px 6px; display: flex; flex-direction: column; gap: 5px;
}
.theme-preview-bar {
  height: 8px; border-radius: 3px; background: var(--sidebar-head); opacity: .95;
}
.theme-preview-item {
  height: 7px; border-radius: 3px; background: rgba(255,255,255,.18);
}
.theme-preview-item.active {
  background: rgba(255,255,255,.28); box-shadow: inset 2px 0 0 var(--accent-mark);
}
.theme-preview-accent {
  margin-top: auto; height: 10px; border-radius: 3px; background: var(--accent);
}
.wallpaper-preview {
  position: relative; overflow: hidden;
  width: 72px; height: 72px; min-width: 72px; border-radius: 18px; flex: 0 0 72px;
  background-color: var(--wallpaper-preview-color, #d0e7f5);
  background-image: var(--wallpaper-preview-gradient, none);
  box-shadow: none;
}
.wallpaper-preview.is-pattern::before {
  content: none;
  display: none;
}
.wallpaper-preview.is-custom {
  background-image: var(--wallpaper-preview-image, none);
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
}
.wallpaper-preview.is-custom::before { content: none; display: none; }
.bubble-preview {
  position: relative;
  overflow: hidden;
  width: 72px; height: 72px; min-width: 72px; border-radius: 18px; flex: 0 0 72px;
  display: grid; place-items: center; padding: 10px;
  background-color: var(--wallpaper-color, #d0e7f5);
  background-image: var(--wallpaper-gradient, none);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
html[data-wallpaper="pattern"] .bubble-preview::before {
  content: none;
  display: none;
}
.bubble-preview > * { position: relative; z-index: 1; }
.bubble-preview-msg {
  max-width: 100%; padding: 8px 10px; border-radius: 12px; border-bottom-right-radius: 4px;
  background: color-mix(in srgb, var(--bubble-preview-color, #ffffff) calc(var(--bubble-preview-opacity, 1) * 100%), transparent);
  color: var(--bubble-preview-text, #1a1d26);
  font-size: 13px; font-weight: 700; line-height: 1; box-shadow: 0 1px 1px rgba(16,24,40,.08);
}
.bubble-fill-opacity .avatar-opacity-head {
  justify-content: flex-end;
}
.bubble-fill-row {
  align-items: center;
  width: 100%;
  margin-top: 0;
}
.bubble-opacity-inline {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  flex: 1 1 auto;
  min-width: 0;
}
.bubble-opacity-inline .avatar-opacity-slider {
  width: 100%;
  max-width: 100%;
  margin: 0;
}
.bubble-fill-preview {
  background-color: var(--wallpaper-preview-color, var(--wallpaper-color, #d0e7f5));
  background-image: var(--wallpaper-preview-image, var(--wallpaper-gradient, none));
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.glass-opacity-block {
  max-width: 280px;
}
.glass-preview-row {
  align-items: center;
  width: 100%;
  margin-top: 0;
}
.glass-preview {
  position: relative;
  overflow: hidden;
  width: 72px;
  height: 72px;
  min-width: 72px;
  border-radius: 18px;
  flex: 0 0 72px;
  box-sizing: border-box;
  background-color: var(--wallpaper-preview-color, var(--wallpaper-color, #d0e7f5));
  background-image: var(--wallpaper-preview-image, var(--wallpaper-gradient, none));
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}
.glass-preview-chrome {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8px 6px 0;
}
.glass-preview-chrome-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  height: 22px;
  padding: 0 5px;
  border-radius: 6px;
  border: var(--glass-border);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-sizing: border-box;
}
.glass-preview-av {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent, #1c58d9);
  flex: none;
}
.glass-preview-stack {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}
.glass-preview-name,
.glass-preview-sub {
  display: block;
  height: 3px;
  border-radius: 2px;
  background: rgba(26, 29, 38, .55);
}
.glass-preview-name { width: 70%; }
.glass-preview-sub {
  width: 45%;
  background: rgba(26, 29, 38, .28);
}
.glass-preview-chip {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 7px 6px 0;
}
.glass-preview-search {
  width: 78%;
  padding: 5px;
  border-radius: 7px;
  border: var(--glass-border);
  background: var(--glass-chip-bg);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-sizing: border-box;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .06);
}
.glass-preview-search-field {
  display: block;
  height: 10px;
  border-radius: 3px;
  border: 1px solid rgba(216, 216, 220, .75);
  background: rgba(255, 255, 255, .35);
}
.glass-preview-panel {
  display: flex;
  justify-content: flex-end;
}
.glass-preview-panel-sheet {
  width: 58%;
  height: 100%;
  padding: 8px 6px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border-left: var(--glass-border);
  background: var(--glass-panel-bg);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.glass-preview-panel-av {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: var(--accent, #1c58d9);
  flex: none;
}
.glass-preview-panel-btn {
  display: block;
  width: 100%;
  height: 8px;
  border-radius: 3px;
  border: var(--glass-border);
  background: var(--glass-chip-bg);
  flex: none;
}
.glass-preview-menu {
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
}
.glass-preview-menu-sheet {
  width: 62%;
  height: 100%;
  padding: 8px 6px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: color-mix(in srgb, var(--sidebar) var(--glass-menu-mix, 86%), transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border-right: 1px solid rgba(255, 255, 255, .12);
}
.glass-preview-menu-head {
  display: block;
  height: 8px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .55);
  width: 72%;
}
.glass-preview-menu-row {
  display: block;
  height: 7px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .22);
  width: 88%;
}
.glass-preview-menu-row.is-active {
  background: rgba(255, 255, 255, .42);
  box-shadow: inset 2px 0 0 var(--accent, #4f8cff);
  width: 100%;
}
.glass-preview-tools {
  display: flex;
  align-items: stretch;
  padding: 6px;
}
.glass-preview-tools-sheet {
  flex: 1;
  min-width: 0;
  padding: 7px 6px;
  border-radius: 8px;
  border: var(--glass-border);
  background: var(--glass-tools-bg);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.glass-preview-tools-title {
  display: block;
  height: 7px;
  width: 48%;
  border-radius: 2px;
  background: rgba(26, 29, 38, .55);
}
.glass-preview-tools-tabs {
  display: flex;
  gap: 3px;
}
.glass-preview-tools-tab {
  display: block;
  height: 8px;
  width: 18px;
  border-radius: 999px;
  background: rgba(26, 29, 38, .12);
  flex: none;
}
.glass-preview-tools-tab.is-active {
  background: color-mix(in srgb, var(--accent, #1c58d9) 35%, #fff);
  width: 22px;
}
.glass-preview-tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  margin-top: 1px;
}
.glass-preview-tools-tile {
  display: block;
  aspect-ratio: 1;
  border-radius: 3px;
  background: rgba(26, 29, 38, .14);
}
.wallpaper-controls { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.wallpaper-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.wallpaper-actions .btn { padding: 6px 10px; font-size: 13px; }
.wallpaper-actions .btn.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent, #1c58d9) 8%, #fff);
}
.wallpaper-custom-panel {
  position: relative;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  border: 1px solid #e8eaef;
  border-radius: 14px;
  background: #fafbfc;
  min-width: 0;
}
.wallpaper-custom-panel.hidden { display: none !important; }
.wallpaper-gradient-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #5c6270;
}
.wallpaper-grad-swatches {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.wallpaper-grad-item {
  position: relative;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
}
.wallpaper-grad-item[hidden] { display: none !important; }
/* Same framed square language as .theme-swatch / .cal-color */
.wallpaper-grad-swatch {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid #d8dbe3;
  padding: 2px;
  margin: 0;
  cursor: pointer;
  box-sizing: border-box;
  background:
    linear-gradient(var(--grad-swatch, #fff2ff), var(--grad-swatch, #fff2ff)) content-box,
    #fff;
  display: block;
}
.wallpaper-grad-swatch:hover { transform: scale(1.04); }
.wallpaper-grad-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}
.wallpaper-grad-remove {
  position: absolute;
  top: -5px;
  right: -5px;
  z-index: 2;
  width: 12px;
  height: 12px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #2a3140;
  color: #fff;
  font-size: 10px;
  line-height: 12px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.wallpaper-grad-remove:hover { background: #111827; }
.wallpaper-grad-remove[hidden] { display: none !important; }
.wallpaper-grad-add {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px dashed rgba(0,0,0,.28);
  background: #fff;
  color: #5c6270;
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  flex: 0 0 auto;
  box-shadow: none;
  box-sizing: border-box;
}
.wallpaper-grad-add:hover {
  border-color: rgba(0,0,0,.38);
  color: #1a1d26;
  transform: scale(1.04);
}
.wallpaper-grad-item.is-editing .wallpaper-grad-swatch {
  border-color: var(--accent, #1c58d9);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent, #1c58d9) 28%, transparent);
}
.wallpaper-color-picker {
  position: fixed;
  z-index: 1200;
  width: 220px;
  padding: 12px;
  border: 1px solid #e4e7ec;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.16);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.wallpaper-color-picker.hidden { display: none !important; }
.wallpaper-color-picker-sv {
  position: relative;
  width: 100%;
  height: 140px;
  border-radius: 10px;
  cursor: crosshair;
  background: hsl(200, 100%, 50%);
  overflow: hidden;
  touch-action: none;
}
.wallpaper-color-picker-sv-white,
.wallpaper-color-picker-sv-black {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.wallpaper-color-picker-sv-white {
  background: linear-gradient(to right, #fff, rgba(255,255,255,0));
}
.wallpaper-color-picker-sv-black {
  background: linear-gradient(to top, #000, rgba(0,0,0,0));
}
.wallpaper-color-picker-thumb {
  position: absolute;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0,0,0,.25), 0 1px 3px rgba(0,0,0,.25);
  pointer-events: none;
}
.wallpaper-color-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.wallpaper-color-picker-preview {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid #d8dbe3;
  padding: 2px;
  box-sizing: border-box;
  flex: 0 0 auto;
  background:
    linear-gradient(var(--picker-swatch, #fff2ff), var(--picker-swatch, #fff2ff)) content-box,
    #fff;
}
.wallpaper-color-picker-hue {
  position: relative;
  flex: 1 1 auto;
  height: 14px;
  border-radius: 999px;
  cursor: pointer;
  touch-action: none;
  background: linear-gradient(to right,
    #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
}
.wallpaper-color-picker-hue-thumb {
  position: absolute;
  top: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,.2), 0 1px 3px rgba(0,0,0,.2);
  background: #f00;
  pointer-events: none;
}
.wallpaper-color-picker-hex-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.wallpaper-color-picker-hex {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid #d0d4dc;
  border-radius: 8px;
  padding: 7px 10px;
  font: inherit;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #fff;
  color: #1a1d26;
  text-transform: uppercase;
}
.wallpaper-color-picker-hex:focus {
  outline: none;
  border-color: var(--accent, #1c58d9);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #1c58d9) 18%, transparent);
}
.wallpaper-color-picker-format {
  flex: 0 0 auto;
  min-width: 44px;
  text-align: center;
  border: 1px solid #d0d4dc;
  border-radius: 8px;
  padding: 7px 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #1a1d26;
  background: #f4f5f7;
}
.wallpaper-name-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.wallpaper-preset-name {
  flex: 1 1 160px;
  min-width: 140px;
  border: 1px solid #d0d4dc;
  border-radius: 8px;
  padding: 7px 10px;
  font: inherit;
  font-size: 13px;
  background: #fff;
  color: #1a1d26;
}
.wallpaper-preset-name:focus {
  outline: none;
  border-color: var(--accent, #1c58d9);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #1c58d9) 18%, transparent);
}
.wallpaper-name-row .btn {
  padding: 6px 10px;
  font-size: 13px;
  flex: 0 0 auto;
}
.wallpaper-name-row .btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.wallpaper-presets-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wallpaper-presets-title {
  font-size: 13px;
  font-weight: 600;
  color: #5c6270;
}
.wallpaper-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
  min-height: 28px;
}
.wallpaper-preset-item {
  position: relative;
  width: 56px;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.wallpaper-preset-swatch {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid #d8dbe3;
  padding: 2px;
  margin: 0;
  cursor: pointer;
  box-sizing: border-box;
  background: var(--preset-fill, #d0e7f5) content-box, #fff;
  display: block;
}
.wallpaper-preset-swatch:hover { transform: scale(1.04); }
.wallpaper-preset-remove {
  position: absolute;
  top: -5px;
  right: 8px;
  z-index: 2;
  width: 14px;
  height: 14px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #2a3140;
  color: #fff;
  font-size: 11px;
  line-height: 14px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.wallpaper-preset-remove:hover { background: #111827; }
.wallpaper-preset-caption {
  max-width: 56px;
  font-size: 11px;
  font-weight: 600;
  color: #5c6270;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wallpaper-presets-hint {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  color: #8a91a0;
}
.wallpaper-grad-add[hidden] { display: none !important; }
.wallpaper-crop-editor {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.wallpaper-crop-editor.hidden { display: none !important; }
.wallpaper-crop-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.wallpaper-crop-tab {
  appearance: none;
  border: 1px solid #e4e7ec;
  background: #fff;
  color: #5c6270;
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.wallpaper-crop-tab:hover { background: #f3f5f8; color: #1f2430; }
.wallpaper-crop-tab.active {
  border-color: transparent;
  background: var(--action, #1c58d9);
  color: var(--action-text, #fff);
}
.wallpaper-crop-stage-wrap {
  display: flex;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.wallpaper-crop-frame {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: none;
  background: transparent;
  touch-action: none;
  cursor: grab;
  user-select: none;
}
.wallpaper-crop-frame.is-dragging { cursor: grabbing; }
.wallpaper-crop-frame.is-static { cursor: default; touch-action: auto; }
.wallpaper-crop-frame.is-desktop {
  width: min(100%, 360px);
  aspect-ratio: 16 / 10;
}
.wallpaper-crop-frame.is-mobile {
  width: min(220px, 56%);
  aspect-ratio: 9 / 16;
}
.wallpaper-crop-img {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: 50% 50%;
  pointer-events: none;
}
.wallpaper-crop-zoom-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 48px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  color: #5c6270;
}
.wallpaper-crop-zoom-row input[type="range"] { width: 100%; }
.wallpaper-crop-zoom-row span { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; color: #1a1d26; }
.wallpaper-crop-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
  color: #8b8e98;
}
.avatar-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.avatar-swatch, .theme-swatch, .wallpaper-swatch, .bubble-swatch {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid #d8dbe3;
  padding: 3px; cursor: pointer; box-sizing: border-box;
  background: #fff;
}
.avatar-swatch[data-style="purple"], .theme-swatch[data-theme="purple"] {
  background: linear-gradient(#7939f2, #7939f2) content-box, #fff;
}
.avatar-swatch[data-style="blue"], .theme-swatch[data-theme="blue"] {
  background: linear-gradient(#1c58d9, #1c58d9) content-box, #fff;
}
.avatar-swatch[data-style="green"], .theme-swatch[data-theme="green"] {
  background: linear-gradient(#3db887, #3db887) content-box, #fff;
}
.avatar-swatch[data-style="red"], .theme-swatch[data-theme="red"] {
  background: linear-gradient(#d24b4e, #d24b4e) content-box, #fff;
}
.avatar-swatch[data-style="orange"], .theme-swatch[data-theme="orange"] {
  background: linear-gradient(#e0941a, #e0941a) content-box, #fff;
}
.avatar-swatch[data-style="navy"], .theme-swatch[data-theme="navy"] {
  background: linear-gradient(#1e325c, #1e325c) content-box, #fff;
}
/* Same hue order as theme/avatar: purple, blue, green, red, orange, navy */
.wallpaper-swatch[data-color="#ead9e8"] { background: linear-gradient(#ead9e8, #ead9e8) content-box, #fff; }
.wallpaper-swatch[data-color="#d0e7f5"] { background: linear-gradient(#d0e7f5, #d0e7f5) content-box, #fff; }
.wallpaper-swatch[data-color="#ddecd8"] { background: linear-gradient(#ddecd8, #ddecd8) content-box, #fff; }
.wallpaper-swatch[data-color="#edd9d9"] { background: linear-gradient(#edd9d9, #edd9d9) content-box, #fff; }
.wallpaper-swatch[data-color="#f3e8d4"] { background: linear-gradient(#f3e8d4, #f3e8d4) content-box, #fff; }
.wallpaper-swatch[data-color="#dde0e8"] { background: linear-gradient(#dde0e8, #dde0e8) content-box, #fff; }
.bubble-swatch[data-color="#f0e0fc"] { background: linear-gradient(#f0e0fc, #f0e0fc) content-box, #fff; }
.bubble-swatch[data-color="#eef8fc"] { background: linear-gradient(#eef8fc, #eef8fc) content-box, #fff; }
.bubble-swatch[data-color="#e5faf6"] { background: linear-gradient(#e5faf6, #e5faf6) content-box, #fff; }
.bubble-swatch[data-color="#fde8e8"] { background: linear-gradient(#fde8e8, #fde8e8) content-box, #fff; }
.bubble-swatch[data-color="#fff3d6"] { background: linear-gradient(#fff3d6, #fff3d6) content-box, #fff; }
.bubble-swatch[data-color="#e8ecf4"] { background: linear-gradient(#e8ecf4, #e8ecf4) content-box, #fff; }
.avatar-swatch:hover, .theme-swatch:hover, .wallpaper-swatch:hover, .bubble-swatch:hover { transform: scale(1.04); }
.appearance-block { margin-top: 18px; }
.avatar-swatch[aria-checked="true"], .theme-swatch[aria-checked="true"], .wallpaper-swatch[aria-checked="true"], .bubble-swatch[aria-checked="true"] {
  border-color: var(--accent, #1c58d9);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent, #1c58d9) 28%, transparent);
}
.admin-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid #f0f0f0;
}
.admin-row strong { display: block; }
.admin-row span { color: #6b7080; font-size: 13px; }
.admin-row select { border: 1px solid #d0d4dc; border-radius: 4px; padding: 6px 8px; background: #fff; color: var(--text-strong); }
.user-head, .admin-row.user-line {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.4fr);
  align-items: center; gap: 16px;
}
.user-head.with-role, .admin-row.user-line.with-role {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto;
}
.user-head {
  padding: 8px 0; border-bottom: 1px solid #eceef2;
  color: var(--text-strong); font-size: 14px; font-weight: 700;
}
.user-person { display: flex; align-items: center; min-width: 0; }
.user-person strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-login-cell {
  display: flex; align-items: center; gap: 4px; min-width: 0;
}
.admin-row .user-login {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text-strong); font-size: 15px; min-width: 0; flex: 1;
}
.admin-row.is-disabled .user-person strong,
.admin-row.is-disabled .user-login { color: #8b8e98; }
.row-actions { position: relative; display: flex; align-items: center; gap: 2px; flex: none; }
.row-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 6; min-width: 230px;
  background: #fff; color: var(--text-strong); border-radius: 8px; box-shadow: 0 12px 32px rgba(0,0,0,.18); padding: 6px 0;
}
.row-menu button {
  display: block; width: 100%; text-align: left; background: none; border: none; padding: 8px 14px; color: var(--text-strong);
}
.row-menu button:hover { background: var(--accent-soft); }
.row-menu button.danger { color: #d24b4e; }
.settings-card h2 { margin: 22px 0 0; font-size: calc(15px * var(--text-scale, 1)); }
.settings-card input:disabled { background: #f4f5f7; color: #6b7080; }
.settings-card label { display: block; margin: 14px 0 4px; font-size: calc(13px * var(--text-scale, 1)); font-weight: 700; }
.settings-card input, .settings-card select { width: 100%; }
.settings-card input[type="text"],
.settings-card input[type="password"],
.settings-card input:not([type]) {
  font-size: calc(15px * var(--text-scale, 1));
}
.settings-card select {
  border: 1px solid #d0d4dc; border-radius: 4px; padding: 8px 12px;
  background: #fff; color: var(--text-strong);
  font-size: calc(15px * var(--text-scale, 1)); font-weight: 700; line-height: 1.35;
  min-height: 0; box-sizing: border-box;
}
#setting-language {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  font-size: calc(15px * var(--text-scale, 1));
  font-weight: 400;
  padding: 8px 12px;
  min-height: 0;
}
.settings-card label.settings-toggle {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0 0;
  padding: 14px;
  border: 1px solid #ebebeb;
  border-radius: 10px;
  cursor: pointer;
  font-size: calc(14px * var(--text-scale, 1));
  font-weight: 400;
  box-sizing: border-box;
}
.settings-card label.settings-toggle input[type="checkbox"] {
  /* Full-label hit target — Android WebView often ignores zero-size inputs. */
  position: absolute;
  inset: 0;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 0;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  pointer-events: auto;
  z-index: 2;
}
.settings-card .settings-toggle-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.settings-card .settings-toggle-text strong {
  display: block;
  font-size: calc(14px * var(--text-scale, 1));
  color: var(--text-strong);
  font-weight: 700;
  line-height: 1.3;
}
.settings-card .settings-toggle-text > span {
  display: block;
  font-size: calc(13px * var(--text-scale, 1));
  color: #6b7080;
  font-weight: 400;
  line-height: 1.35;
}
.settings-card .settings-toggle-ui {
  flex: 0 0 44px;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: #cfd3db;
  position: relative;
  z-index: 1;
  transition: background .15s ease;
}
.settings-card .settings-toggle-ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform .15s ease;
}
.settings-card label.settings-toggle input:checked + .settings-toggle-ui {
  background: var(--accent);
}
.settings-card label.settings-toggle input:checked + .settings-toggle-ui::after {
  transform: translateX(18px);
}
.settings-card label.settings-toggle:has(input:disabled) {
  opacity: .55;
  cursor: default;
}
.settings-card label.settings-toggle input:disabled {
  pointer-events: none;
  cursor: default;
}
.setting-line { display: flex; align-items: center; gap: 4px; }
.setting-line input { width: auto; flex: 1; min-width: 0; }
.role-name-row { margin-top: 10px; }
.role-name-row input { font-size: 16px; font-weight: 700; color: var(--text-strong); }
.profile-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  padding-bottom: 32px;
}
/* Settings Close/Save: idle = white + border; ready Save = action fill. */
.profile-actions .btn {
  flex: 1;
  width: auto;
  margin-top: 0;
  text-align: center;
  background: #fff;
  color: var(--text-strong, #1a1d26);
  border: 1px solid #d0d4dc;
  box-shadow: none;
  filter: none;
  opacity: 1;
}
.profile-actions .btn:hover:not(.primary):not(:disabled),
.profile-actions .btn:focus-visible:not(.primary):not(:disabled) {
  background: #fff;
  color: var(--text-strong, #1a1d26);
  border-color: #d0d4dc;
  box-shadow: none;
}
.profile-actions .btn.ghost,
.profile-actions .btn:disabled {
  background: #fff;
  color: #8b8e98;
  border: 1px solid #d0d4dc;
  opacity: 1;
  cursor: default;
}
.profile-actions .btn.ghost:hover:not(:disabled),
.profile-actions .btn.ghost:focus-visible:not(:disabled) {
  background: #fff;
  color: #8b8e98;
  border-color: #d0d4dc;
  box-shadow: none;
}
.profile-actions .btn.primary,
.profile-actions .btn.primary:disabled {
  background: var(--action, #1c58d9);
  color: var(--action-text, #fff);
  border-color: transparent;
  opacity: 1;
  cursor: pointer;
}
.profile-actions .btn.primary:hover,
.profile-actions .btn.primary:focus-visible {
  background: var(--action-hover, #154ab8);
  color: var(--action-text, #fff);
  border-color: transparent;
}
.workspace-settings-block { margin-top: 28px; padding-top: 20px; border-top: 1px solid #e6e8ee; }
.workspace-settings-block h1 { margin-top: 0; }
.workspace-settings-block.hidden { display: none !important; }
#admin-actions.hidden { display: none !important; }
#profile-actions.hidden { display: none !important; }
.composer-shell {
  border: var(--glass-border);
  border-radius: 8px;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  padding: 8px 8px 8px 10px;
  max-width: 100%;
  min-width: 0;
  overflow: visible;
  position: relative;
  z-index: 3;
  /* Allow the textarea to grow past one line without clipping. */
  max-height: none;
}
.composer-wrap {
  padding: 8px 16px calc(12px + var(--kb-inset, 0px));
  flex: none; background: transparent; border-top: none;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  position: relative;
  z-index: 3;
  overflow: visible;
}
.composer-shell.hidden { display: none !important; }
.composer-shell.has-draft { padding-top: 8px; }
.composer-draft {
  display: flex; align-items: flex-start; gap: 8px;
  margin: 0 0 8px; min-height: 36px;
}
.composer-draft[hidden] { display: none !important; }
.composer-draft-accent {
  width: 3px; align-self: stretch; min-height: 32px; border-radius: 2px;
  background: var(--accent); flex: none;
}
.composer-draft-text { flex: 1; min-width: 0; padding-top: 1px; }
.composer-draft-title {
  color: var(--accent); font-size: 13px; font-weight: 600; line-height: 1.25;
}
.composer-draft-preview {
  color: #1f2430; font-size: 13px; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px;
}
.composer-shell.editing .composer-draft-preview { color: #8b8e98; }
.composer-draft-close {
  appearance: none; border: 0; background: transparent; color: #6b7080;
  width: 28px; height: 28px; font-size: 22px; line-height: 1;
  padding: 0; cursor: pointer; flex: none; border-radius: 4px;
  display: grid; place-items: center;
}
.composer-draft-close:hover { color: #1f2430; background: #f0f2f5; }
.select-bar {
  display: flex; align-items: center; gap: 8px; padding: 8px 4px 2px;
}
.select-bar.hidden { display: none !important; }
.select-bar .btn {
  border: 0;
  border-radius: 999px;
  background: #e6e7ea;
  color: #2c3038;
  box-shadow: none;
  padding: 10px 18px;
  min-width: 108px;
  font-size: 15px;
  font-weight: 600;
}
.select-bar .btn.danger {
  color: #d24b4e;
  background: #fff;
  border: 0;
  border-radius: 999px;
}
.select-bar .btn:hover:not(:disabled) { background: #dcdee2; }
.select-bar .btn.danger:hover:not(:disabled) { background: #f4f5f7; color: #d24b4e; }
.select-count {
  margin-right: auto; color: var(--text-strong); font-size: 14px; font-weight: 600;
}
.msg-menu {
  position: fixed; z-index: 80; min-width: 220px; max-width: min(92vw, 320px);
  background: #fff; border-radius: 12px; padding: 6px 0;
  box-shadow: 0 8px 28px rgba(20, 28, 45, .18), 0 0 0 1px rgba(20, 28, 45, .06);
  overflow: hidden;
}
.msg-menu.hidden { display: none !important; }
.msg-menu-reactions {
  display: flex; align-items: center; justify-content: space-between; gap: 0;
  padding: 8px 10px; border-bottom: 1px solid #eef0f4; box-sizing: border-box;
  width: 100%;
}
.msg-menu-react {
  width: 30px; height: 30px; border: 0; border-radius: 50%;
  background: transparent; font-size: 18px; line-height: 1; cursor: pointer;
  display: grid; place-items: center; padding: 0; flex: 0 0 auto;
}
.msg-menu-react:hover, .msg-menu-react:focus-visible {
  background: #f3f5f8; outline: none;
}
.msg-menu-react.is-more {
  width: 26px; height: 26px; margin-left: 2px;
  background: #c8ccd4; color: #fff;
}
.msg-menu-react.is-more:hover,
.msg-menu-react.is-more:focus-visible {
  background: #b4b9c3;
}
.msg-menu-react.is-more svg {
  width: 15px; height: 15px; display: block;
}
.msg-menu-item {
  width: 100%; appearance: none; border: 0; background: transparent;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; color: #1f2430; font-size: 15px; text-align: left; cursor: pointer;
}
.msg-menu-item:hover, .msg-menu-item:focus-visible { background: #f3f5f8; outline: none; }
.msg-menu-item svg { width: 20px; height: 20px; flex: none; color: #5c6270; }
.msg-menu-ico-spacer {
  width: 20px; height: 20px; flex: none; display: block;
}
.msg-menu-item.has-trail > span:nth-child(2) { flex: 1; min-width: 0; }
.msg-menu-item.is-views {
  color: #1f2430;
}
.msg-menu-item.is-views:hover,
.msg-menu-item.is-views:focus-visible {
  background: #f3f5f8;
  color: #1f2430;
  outline: none;
}
.msg-menu-people {
  display: inline-flex; align-items: center; flex: none; margin-left: auto;
  height: 18px; max-height: 18px; overflow: visible;
}
.msg-menu-item .msg-menu-people .avatar.msg-menu-person,
.msg-menu-person {
  width: 18px !important; height: 18px !important;
  min-width: 18px !important; min-height: 18px !important;
  max-width: 18px !important; max-height: 18px !important;
  flex: 0 0 18px !important; align-self: center !important;
  font-size: 8px !important; line-height: 18px !important;
  margin-left: -5px; margin-top: 0 !important; margin-bottom: 0 !important;
  box-shadow: 0 0 0 1.5px #fff; pointer-events: none;
  overflow: hidden !important;
  box-sizing: border-box !important;
}
.msg-menu-person:first-child { margin-left: 0; }
.msg-menu-item .msg-menu-people .avatar.msg-menu-person img,
.msg-menu-person img {
  position: absolute; inset: 0;
  width: 100% !important; height: 100% !important;
  object-fit: cover;
}
.msg-menu-item .msg-menu-people .avatar.msg-menu-person .presence,
.msg-menu-person .presence,
.msg-menu-views-flyout-av .presence {
  display: none !important;
}
.msg-menu-trailing {
  flex: none; margin-left: 6px; color: #8b8e98;
  font-size: 15px; font-weight: 700; letter-spacing: -0.5px; line-height: 1;
}
.msg-menu-views-flyout {
  position: fixed; z-index: 90; min-width: 176px; max-width: min(72vw, 240px);
  max-height: min(50vh, 280px); overflow: auto;
  background: #fff; border-radius: 12px; padding: 6px 0;
  box-shadow: 0 8px 28px rgba(20, 28, 45, .18), 0 0 0 1px rgba(20, 28, 45, .06);
}
.msg-menu-views-flyout-empty {
  padding: 12px 14px; color: #8b8e98; font-size: 13px; line-height: 1.3;
}
.msg-menu-views-flyout-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px; min-width: 0;
}
.msg-menu-views-flyout-av {
  width: 28px !important; height: 28px !important;
  min-width: 28px !important; min-height: 28px !important;
  max-width: 28px !important; max-height: 28px !important;
  flex: 0 0 28px !important; align-self: center !important;
  font-size: 11px !important; overflow: hidden;
}
.msg-menu-views-flyout-av .presence {
  width: 8px; height: 8px;
}
.msg-menu-views-flyout-name {
  min-width: 0; flex: 1;
  color: #1f2430; font-size: 14px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.msg-menu-item.danger { color: #d24b4e; }
.msg-menu-item.danger svg { color: #d24b4e; }
.msg-menu-item.is-disabled,
.msg-menu-item:disabled {
  opacity: .45; cursor: default; pointer-events: none;
}
.msg-menu-sep {
  height: 1px; margin: 6px 0; background: #eef0f4;
}
.nav-mute {
  display: inline-flex; align-items: center; justify-content: center;
  flex: none; opacity: .55; color: #c5ccd8;
}
.nav-mute svg { width: 14px; height: 14px; display: block; }
.nav-item .nav-mute:last-child { margin-left: auto; }
/* Format toolbar slides up out of the composer when the input is focused. */
.composer-format-slot {
  display: grid;
  grid-template-rows: 0fr;
  flex: none;
  width: 100%;
  min-width: 0;
  opacity: 0;
  pointer-events: none;
  transition:
    grid-template-rows .34s cubic-bezier(.22, .61, .36, 1),
    opacity .26s ease;
}
.composer-format-slot.hidden { display: none !important; }
html.composer-focused .composer-format-slot:not(.hidden),
html.composer-format-hold .composer-format-slot:not(.hidden) {
  grid-template-rows: 1fr;
  opacity: 1;
  pointer-events: auto;
}
.composer-format-slot-inner {
  min-height: 0;
  overflow: hidden;
}
.composer-format {
  display: flex;
  align-items: center;
  gap: 2px;
  width: 100%;
  min-width: 0;
  padding: 0 2px 6px;
  margin: 0 0 2px;
  border-bottom: 1px solid rgba(180, 186, 198, 0.45);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  transform: translateY(10px);
  opacity: 0;
  transition:
    transform .34s cubic-bezier(.22, .61, .36, 1),
    opacity .26s ease;
}
.composer-format::-webkit-scrollbar { display: none; }
html.composer-focused .composer-format-slot:not(.hidden) .composer-format,
html.composer-format-hold .composer-format-slot:not(.hidden) .composer-format {
  transform: translateY(0);
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  .composer-format-slot,
  .composer-format {
    transition: none !important;
  }
}
.composer-fmt-sep {
  flex: none;
  width: 1px;
  height: 16px;
  margin: 0 4px;
  background: rgba(160, 166, 180, 0.55);
}
.composer-fmt-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: #5c6270;
  width: 30px;
  height: 28px;
  padding: 0;
  border-radius: 6px;
  display: grid;
  place-items: center;
  flex: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.composer-fmt-btn svg { display: block; width: 17px; height: 17px; }
.composer-fmt-glyph {
  font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}
.composer-fmt-glyph.is-bold { font-weight: 800; }
.composer-fmt-glyph.is-italic { font-style: italic; font-weight: 700; }
.composer-fmt-glyph.is-underline { text-decoration: underline; text-underline-offset: 2px; }
.composer-fmt-glyph.is-strike { text-decoration: line-through; }
@media (hover: hover) {
  .composer-fmt-btn:hover:not(:disabled) {
    color: var(--accent);
    background: rgba(255, 255, 255, 0.45);
  }
}
.composer-fmt-btn:active:not(:disabled) { color: var(--accent); }
.composer-fmt-btn.is-active:not(:disabled) {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.6);
}
.composer-fmt-btn:disabled { opacity: .4; cursor: default; }
.composer-shell:has(.composer.is-recording) .composer-format-slot { display: none !important; }
.composer {
  display: flex; align-items: flex-end; gap: 6px; border: none; border-radius: 0; padding: 0; background: transparent;
  min-width: 0; width: 100%;
}
.msg-body .md-bold { font-weight: 700; }
.msg-body .md-italic { font-style: italic; }
.msg-body .md-underline { text-decoration: underline; text-underline-offset: 2px; }
.msg-body .md-strike { text-decoration: line-through; }
.msg-body .md-h {
  display: block;
  font-size: 1.15em;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 2px;
}
.msg-body .md-quote {
  display: block;
  margin: 2px 0;
  padding: 2px 0 2px 8px;
  border-left: 3px solid var(--accent);
  color: inherit;
  opacity: .92;
}
.msg-body .md-li {
  display: block;
  padding-left: 0.2em;
}
.msg-body .md-pre {
  display: block;
  margin: 4px 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, .06);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .88em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.attach-btn, .emoji-btn, .media-btn, .send {
  width: var(--chrome-icon-btn); height: var(--chrome-icon-btn); border: none; border-radius: 4px; background: transparent;
  color: #8b8e98; display: grid; place-items: center; flex: none; padding: 0; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) {
  .attach-btn:hover:not(:disabled), .emoji-btn:hover:not(:disabled),
  .media-btn:hover:not(:disabled):not(.is-armed):not(.is-recording),
  .send:hover:not(:disabled) {
    color: var(--accent);
    background: transparent;
  }
}
.attach-btn:active:not(:disabled), .emoji-btn:active:not(:disabled),
.media-btn:active:not(:disabled):not(.is-armed):not(.is-recording),
.send:active:not(:disabled) {
  color: var(--accent);
  background: transparent;
}
.attach-btn:disabled, .emoji-btn:disabled, .media-btn:disabled { opacity: .45; cursor: default; }
.attach-btn svg, .emoji-btn svg, .media-btn svg, .send svg {
  width: var(--chrome-icon-svg); height: var(--chrome-icon-svg); display: block;
}
.composer-tools { position: relative; display: flex; align-items: flex-end; gap: 4px; flex: none; z-index: 4; overflow: visible; }
.emoji-picker {
  position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 20;
  width: min(320px, calc(100vw - 32px)); max-height: min(300px, 45vh);
  display: flex; flex-direction: column; overflow: hidden;
  padding: 0; background: #fff; border: 1px solid #e4e7ec; border-radius: 12px;
  box-shadow: 0 10px 28px rgba(16, 24, 40, .16);
}
.emoji-picker.hidden { display: none !important; }
.emoji-picker-tabs {
  display: flex; gap: 2px; flex: none; padding: 6px 6px 4px;
  border-bottom: 1px solid #eef0f4; overflow-x: auto;
  scrollbar-width: none;
}
.emoji-picker-tabs::-webkit-scrollbar { display: none; }
.emoji-picker-tab {
  flex: none; width: 32px; height: 32px; border: none; border-radius: 8px;
  background: transparent; color: #5c6270; font-size: 16px; line-height: 1;
  cursor: pointer; padding: 0; display: grid; place-items: center;
}
.emoji-picker-tab-img { width: 22px; height: 22px; object-fit: contain; image-rendering: auto; }
.emoji-picker-tab:hover { background: #f3f5f8; }
.emoji-picker-tab.active { background: var(--accent-soft); color: var(--accent); }
.emoji-picker-body {
  flex: 1; min-height: 0; overflow: auto; padding: 6px 8px 8px;
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px;
  align-content: start;
}
.emoji-picker-body.is-icq {
  grid-template-columns: repeat(6, 1fr);
}
.emoji-picker-title {
  grid-column: 1 / -1; font-size: 12px; font-weight: 600; color: #8b8e98;
  padding: 4px 2px 6px; letter-spacing: .02em;
}
.emoji-picker-empty {
  grid-column: 1 / -1; color: #8b8e98; font-size: 13px; padding: 18px 8px; text-align: center;
}
.emoji-picker-item {
  width: 100%; aspect-ratio: 1; border: none; border-radius: 8px; background: transparent;
  font-size: 28px; line-height: 1; cursor: pointer; padding: 0;
  display: grid; place-items: center;
  -webkit-text-size-adjust: 100%;
}
.emoji-picker-item.is-icq { padding: 4px; }
.emoji-picker-item.is-icq img.icq-smiley { width: 32px; height: 32px; }
.emoji-picker-item.is-text {
  aspect-ratio: auto; min-height: 36px; font-size: 13px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 600; color: #3f4350; padding: 6px 4px;
}
.emoji-picker-item:hover, .emoji-picker-item:focus-visible,
.emoji-picker-tab:focus-visible { background: var(--accent-soft); outline: none; }
.icq-smiley {
  width: 28px; height: 28px; vertical-align: -6px; display: inline-block;
  object-fit: contain; margin: 0 1px;
}
.icq-smiley.large {
  width: 48px; height: 48px; vertical-align: bottom; margin: 0 2px;
}
.msg.emoji-only .msg-body.icq-only {
  font-size: inherit; letter-spacing: 0; line-height: 1;
  display: flex; flex-wrap: wrap; gap: 4px; align-items: flex-end;
}
.msg.emoji-only.emoji-1 .msg-body.icq-only .icq-smiley.large { width: 60px; height: 60px; }
.msg.emoji-only.emoji-2 .msg-body.icq-only .icq-smiley.large { width: 48px; height: 48px; }
.msg.emoji-only.emoji-3 .msg-body.icq-only .icq-smiley.large { width: 40px; height: 40px; }
.composer-fields {
  flex: 1; min-width: 0; min-height: 0;
  display: flex; flex-direction: column; gap: 6px;
  align-self: stretch;
}
.attach-preview {
  display: flex; align-items: flex-start; gap: 6px;
}
.attach-preview.hidden { display: none !important; }
.attach-preview-list {
  display: flex; flex-wrap: wrap; gap: 8px; width: 100%;
}
.attach-preview-item { flex: none; max-width: 100%; }
.attach-preview-item.is-image { flex: none; }
.attach-preview-file {
  display: flex; align-items: center; gap: 6px; padding: 4px 6px; width: 100%;
  background: #f3f5f8; border-radius: 6px; font-size: 13px; color: #3f4350;
  max-width: 280px;
}
.attach-preview-ico { flex: none; }
.attach-preview-name {
  flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.attach-preview-thumb-wrap {
  position: relative; flex: none; width: 72px; height: 72px;
  border-radius: 10px; overflow: visible;
}
.attach-preview-thumb {
  display: block; width: 72px; height: 72px; object-fit: cover;
  border-radius: 10px; background: #e8eaee; border: 1px solid rgba(0,0,0,.06);
}
.attach-preview-clear {
  appearance: none; border: 0; background: transparent; color: #8b8e98;
  font-size: 18px; line-height: 1; padding: 0 2px; cursor: pointer; flex: none;
}
.attach-preview-clear:hover { color: #d24b4e; }
.attach-preview-clear-thumb {
  position: absolute; top: -6px; right: -6px; z-index: 1;
  width: 22px; height: 22px; padding: 0; border-radius: 50%;
  background: #9aa0a8; color: #fff; font-size: 14px; line-height: 20px;
  text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.attach-preview-clear-thumb:hover { background: #d24b4e; color: #fff; }
.composer textarea,
.composer .composer-rich {
  flex: 1 1 auto; width: 100%; min-width: 0; max-width: 100%;
  border: none; resize: none; font-size: calc(15px * var(--text-scale, 1)); line-height: 1.4;
  padding: 6px 4px; outline: none; background: transparent;
  white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
  overflow-x: hidden; overflow-y: hidden;
  min-height: calc(1.4em + 12px);
  height: calc(1.4em + 12px);
  max-height: min(calc(1.4em * 8 + 12px), var(--composer-max-h, 9999px));
  box-sizing: border-box;
  text-align: left;
  /* Grow with content where supported; JS mirror covers iOS Safari. */
  field-sizing: content;
  -webkit-overflow-scrolling: auto;
}
/* Rich composer (composer-rich.js): a contenteditable stand-in for the textarea.
   Each line is a .cl element; block styles mirror .msg-body .md-* so the draft looks
   like the sent message. */
.composer .composer-rich {
  position: relative;
  display: block;
  cursor: text;
  /* Same ink as the textarea it replaces (form controls do not inherit color). */
  color: fieldtext;
  caret-color: fieldtext;
  -webkit-user-select: text;
  user-select: text;
  tab-size: 4;
}
.composer .composer-rich.is-disabled { cursor: default; }
.composer .composer-rich.is-empty::before {
  content: attr(data-placeholder);
  position: absolute;
  left: 4px; right: 4px; top: 6px;
  color: #757575;
  pointer-events: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.composer-rich .cl { min-height: 1.4em; }
.composer-rich b, .composer-rich strong { font-weight: 700; }
.composer-rich i, .composer-rich em { font-style: italic; }
.composer-rich u { text-decoration: underline; text-underline-offset: 2px; }
.composer-rich s, .composer-rich strike, .composer-rich del { text-decoration: line-through; }
.composer-rich u s, .composer-rich s u, .composer-rich u strike, .composer-rich strike u {
  text-decoration: underline line-through;
}
.composer-rich a { color: var(--accent); text-decoration: underline; cursor: text; }
.composer-rich code {
  background: rgba(0,0,0,.06); border-radius: 3px; padding: 1px 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em;
}
.composer-rich .cl[data-b="h"] { font-size: 1.15em; font-weight: 700; line-height: 1.3; min-height: 1.3em; }
.composer-rich .cl[data-b="q"] {
  padding-left: 8px;
  border-left: 3px solid var(--accent);
  opacity: .92;
}
.composer-rich .cl[data-b="ul"],
.composer-rich .cl[data-b="ol"] { padding-left: 0.2em; }
.composer-rich .cl[data-b="ul"]::before { content: "\2022\00a0"; }
.composer-rich .cl[data-b="ol"]::before { content: attr(data-n) ".\00a0"; }
.composer-rich .cl[data-b="code"] {
  padding: 0 10px;
  background: rgba(0, 0, 0, .06);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .88em;
}
.composer-rich .cl[data-b="code"]:not(.cl[data-b="code"] + .cl) {
  margin-top: 4px; padding-top: 6px; border-radius: 8px 8px 0 0;
}
.composer-rich .cl[data-b="code"]:not(:has(+ .cl[data-b="code"])) {
  margin-bottom: 4px; padding-bottom: 6px; border-radius: 0 0 8px 8px;
}
.composer-rich .cl[data-b="code"]:not(.cl[data-b="code"] + .cl):not(:has(+ .cl[data-b="code"])) {
  border-radius: 8px;
}
.send {
  position: relative;
  color: var(--accent);
  overflow: visible;
}
.send-chevrons { display: block; overflow: visible; width: 26px; height: 26px; }
.send-chev-1 { opacity: 1; }
.send-chev-2 { opacity: .9; }
.send-chev-3 { opacity: .72; }
.send:disabled { cursor: default; }
.send:disabled .send-chev-1 { opacity: .88; }
.send:disabled .send-chev-2 { opacity: .72; }
.send:disabled .send-chev-3 { opacity: .55; }
html.is-reconnecting .send .send-chevrons { visibility: hidden; }

.reconnect-indicator {
  position: fixed;
  z-index: 10050;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  pointer-events: none;
  margin: 0;
  padding: 0;
  /* Keep bubble visible above the indicator (not clipped by ancestors). */
  overflow: visible;
}
.reconnect-indicator.hidden { display: none !important; }
.reconnect-indicator .send-satellite {
  display: block;
  width: 26px;
  height: 26px;
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
  animation: send-sat-blink 1.05s ease-in-out infinite;
}
@keyframes send-sat-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.28; }
}
.send-reconnect-bubble {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  transform: translateX(-50%);
  width: 72px;
  height: 22px;
  padding: 0;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.96);
  border: none;
  border-radius: 999px;
  overflow: hidden;
  z-index: 1;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.18);
}
.send-reconnect-marquee {
  display: block;
  height: 100%;
  width: max-content;
  max-width: none;
  white-space: nowrap;
  will-change: transform;
  /* One full pass: enter from the right, exit left — then JS picks the next phrase. */
  transform: translateX(72px);
  animation: none;
}
.send-reconnect-marquee.is-running {
  animation-name: send-reconnect-marquee;
  animation-timing-function: linear;
  animation-iteration-count: 1;
  animation-fill-mode: forwards;
}
.send-reconnect-text {
  display: inline-flex;
  align-items: center;
  height: 100%;
  padding: 0 8px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  color: #1a1d26;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
@keyframes send-reconnect-marquee {
  from { transform: translateX(72px); }
  to { transform: translateX(calc(-100%)); }
}
.media-btn {
  touch-action: none; user-select: none; -webkit-user-select: none;
  position: relative;
}
/* Invisible expanded hit area — especially important on iOS near the home indicator. */
.media-btn::before {
  content: "";
  position: absolute;
  top: -10px;
  right: -8px;
  bottom: -12px;
  left: -8px;
}
.media-btn.hidden, .send.hidden { display: none !important; }
.media-btn.is-armed, .media-btn.is-recording {
  color: #e25555; background: rgba(226, 85, 85, .1);
}
.media-btn-icon { display: grid; place-items: center; }
.media-btn-icon.hidden { display: none !important; }
.composer.is-recording .composer-fields,
.composer.is-recording .attach-btn,
.composer.is-recording .composer-tools { display: none !important; }
.voice-record-bar {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 0 2px;
}
.voice-record-bar.hidden { display: none !important; }
.voice-record-dot {
  width: 10px; height: 10px; border-radius: 50%; background: #e25555; flex: none;
  animation: voice-pulse 1.1s ease-in-out infinite;
}
@keyframes voice-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .45; transform: scale(.85); }
}
.voice-record-time {
  font-size: 15px; font-variant-numeric: tabular-nums; color: #1f2430; font-weight: 600; flex: none;
}
.voice-record-hint { flex: 1; font-size: 13px; color: #8b8e98; }
.msg-file {
  display: flex; align-items: center; gap: 8px; margin: 4px 0 2px; padding: 8px 10px;
  background: rgba(0,0,0,.05); border-radius: 8px; text-decoration: none; color: inherit; max-width: 100%;
}
.msg.mine .msg-file { background: rgba(255,255,255,.4); }
.msg-file:hover { background: rgba(0,0,0,.08); }
.msg-file-ico { flex: none; color: var(--accent); font-size: 16px; }
.msg-file-name {
  flex: 1; min-width: 0; font-size: calc(14px * var(--text-scale, 1)); color: var(--accent); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.msg-file-size { flex: none; font-size: calc(12px * var(--text-scale, 1)); color: #8b8e98; }
.msg-image {
  display: block; max-width: min(100%, 320px); max-height: 280px; border-radius: 8px;
  margin: 2px 0; object-fit: contain; background: rgba(0,0,0,.04);
  box-shadow: 0 0 0 1px rgba(16, 24, 40, .12);
}
.msg.image-only .msg-bubble {
  position: relative;
  padding: 0;
  min-width: 0;
  max-width: 100%;
  overflow: visible;
  background: transparent;
  box-shadow: none;
}
.msg.mine.image-only .msg-bubble {
  background: transparent;
  box-shadow: none;
}
.msg.image-only .msg-body {
  display: flex; flex-wrap: wrap; gap: 2px;
  margin: 0;
}
.msg.image-only .msg-image {
  margin: 0;
  border-radius: 12px;
  max-width: 100%;
  box-shadow: 0 0 0 1px rgba(16, 24, 40, .14);
}
.msg.image-only.image-many .msg-image {
  max-width: calc(50% - 1px);
  max-height: 180px;
  object-fit: cover;
  flex: 1 1 calc(50% - 1px);
  border-radius: 8px;
}
.msg.image-only.image-many .msg-image:first-child { border-top-left-radius: 12px; }
.msg.image-only.image-many .msg-image:nth-child(2) { border-top-right-radius: 12px; }
.msg.image-only .msg-receipt {
  --receipt-muted: rgba(255, 255, 255, .4);
  --receipt-blue: #fff;
}
.msg.image-only .msg-receipt.is-sent .msg-receipt-chev { color: var(--receipt-muted); }
.msg.image-only .msg-receipt.is-delivered .msg-receipt-chev:first-child { color: var(--receipt-blue); }
.msg.image-only .msg-receipt.is-delivered .msg-receipt-chev:last-child { color: var(--receipt-muted); }
.msg.image-only .msg-receipt.is-read .msg-receipt-chev { color: var(--receipt-blue); }
.msg.image-only.mentions-me .msg-bubble { box-shadow: none; }
.image-viewer {
  position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 16px;
}
.image-viewer.hidden { display: none !important; }
.image-viewer-backdrop {
  position: absolute; inset: 0; background: rgba(10, 14, 22, .82);
}
.image-viewer-stage {
  position: relative; z-index: 1; flex: 1; min-height: 0; width: 100%;
  display: grid; place-items: center; pointer-events: none;
}
.image-viewer-frame {
  position: relative;
  display: inline-block;
  max-width: 100%;
  pointer-events: none;
}
.image-viewer-download {
  position: absolute; top: 0; right: 0; z-index: 2;
  transform: translateY(calc(-100% - 8px));
  display: inline-flex; align-items: center; gap: 8px;
  appearance: none; border: 0; background: transparent;
  color: #fff; font: inherit; font-size: 15px; font-weight: 600;
  padding: 0; cursor: pointer; text-shadow: 0 1px 2px rgba(0,0,0,.35);
  pointer-events: auto; white-space: nowrap;
}
.image-viewer-download:hover { opacity: .88; }
.image-viewer-download svg { display: block; flex: none; }
.image-viewer-attach-actions {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  display: flex; align-items: center; gap: 8px;
  pointer-events: auto;
}
.image-viewer-attach-actions.hidden { display: none !important; }
.image-viewer-attach-btn {
  appearance: none; border: 0; cursor: pointer;
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; padding: 0;
  background: rgba(26, 29, 38, .72); color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.28);
  backdrop-filter: blur(6px);
}
.image-viewer-attach-btn:hover { background: rgba(26, 29, 38, .9); }
.image-viewer-attach-btn svg { display: block; }
.image-viewer.is-attach .image-viewer-download { display: none !important; }
.image-viewer.is-attach .image-viewer-frame { pointer-events: auto; }
.image-viewer-img {
  display: block;
  max-width: min(100%, 960px); max-height: calc(100vh - 72px);
  object-fit: contain; border-radius: 8px; background: #111;
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
  pointer-events: auto;
}
.image-viewer-nav {
  display: none; position: absolute; top: 50%; z-index: 4; transform: translateY(-50%);
  appearance: none; border: 0; cursor: pointer; padding: 0;
  width: 44px; height: 44px; border-radius: 50%; place-items: center;
  background: rgba(26, 29, 38, .62); color: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,.3); backdrop-filter: blur(6px);
  pointer-events: auto;
}
.image-viewer-nav.is-prev { left: 8px; }
.image-viewer-nav.is-next { right: 8px; }
.image-viewer.has-nav .image-viewer-nav { display: grid; }
.image-viewer-nav:disabled { opacity: .3; cursor: default; }
.image-viewer-nav:not(:disabled):hover { background: rgba(26, 29, 38, .85); }
.image-viewer-counter {
  display: none; position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  z-index: 4; padding: 4px 12px; border-radius: 999px;
  background: rgba(26, 29, 38, .62); color: #fff; font-size: 14px; font-weight: 600;
  pointer-events: none; font-variant-numeric: tabular-nums;
}
.image-viewer.has-nav .image-viewer-counter { display: block; }
.image-viewer-img { touch-action: pan-y; }
.image-viewer-caption {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 5;
  width: min(100%, 560px); box-sizing: border-box;
  display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 16px;
  border-radius: 24px; background: #fff; color: #1a1d26;
  box-shadow: 0 8px 28px rgba(0,0,0,.3); pointer-events: auto;
}
.image-viewer-caption.hidden { display: none !important; }
.image-viewer-caption textarea {
  flex: 1; min-width: 0; border: 0 !important; outline: 0 !important; resize: none;
  background: transparent !important; box-shadow: none !important; border-radius: 0;
  font: inherit; font-size: 16px; line-height: 1.35; color: inherit;
  padding: 8px 0; max-height: 120px;
}
.image-viewer-caption-send {
  appearance: none; border: 0; cursor: pointer; flex: none; padding: 0;
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent, #3b82f6); color: #fff;
}
.image-viewer.is-attach .image-viewer-stage { padding-bottom: 64px; box-sizing: border-box; }
.image-viewer.is-compact .image-viewer-img {
  max-width: min(86vw, 520px);
  max-height: min(70vh, 640px);
}
.image-editor {
  position: fixed; inset: 0; z-index: 85; display: flex; flex-direction: column;
  align-items: stretch; justify-content: stretch;
  background: #0c1018;
}
.image-editor.hidden { display: none !important; }
.image-editor-backdrop {
  position: absolute; inset: 0; background: #0c1018; z-index: 0;
}
.image-editor-stage {
  position: relative; z-index: 1; flex: 1; min-height: 0;
  display: grid; place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  overflow: hidden; touch-action: none;
}
.image-editor-work {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  gap: 20px;
  width: fit-content;
  max-width: 100%; max-height: 100%;
  min-width: 0;
}
.image-editor-frame {
  position: relative;
  max-width: 100%;
  max-height: calc(100vh - 160px);
  line-height: 0;
}
.image-editor-canvas {
  display: block;
  max-width: min(100vw - 32px, 960px);
  max-height: calc(100vh - 160px);
  width: auto; height: auto;
  border-radius: 8px; background: #111;
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
  touch-action: none; cursor: default;
}
.image-editor.is-draw .image-editor-canvas { cursor: crosshair; }
.image-editor-crop {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
}
.image-editor-crop:not(.hidden) { pointer-events: auto; }
.image-editor-crop-shade {
  position: absolute; background: rgba(0,0,0,.45); pointer-events: none;
}
.image-editor-crop-box {
  position: absolute; box-sizing: border-box;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,.25);
  cursor: move; touch-action: none;
}
.image-editor-crop-handle {
  position: absolute; width: 14px; height: 14px; border-radius: 3px;
  background: #fff; border: 1px solid rgba(0,0,0,.2);
  transform: translate(-50%, -50%); touch-action: none;
}
.image-editor-crop-handle[data-handle="nw"] { left: 0; top: 0; cursor: nwse-resize; }
.image-editor-crop-handle[data-handle="ne"] { left: 100%; top: 0; cursor: nesw-resize; }
.image-editor-crop-handle[data-handle="sw"] { left: 0; top: 100%; cursor: nesw-resize; }
.image-editor-crop-handle[data-handle="se"] { left: 100%; top: 100%; cursor: nwse-resize; }
.image-editor-crop-handle[data-handle="n"] { left: 50%; top: 0; cursor: ns-resize; }
.image-editor-crop-handle[data-handle="s"] { left: 50%; top: 100%; cursor: ns-resize; }
.image-editor-crop-handle[data-handle="w"] { left: 0; top: 50%; cursor: ew-resize; }
.image-editor-crop-handle[data-handle="e"] { left: 100%; top: 50%; cursor: ew-resize; }
.image-editor-crop-handle.is-edge {
  width: 22px; height: 6px; border-radius: 3px;
}
.image-editor-crop-handle.is-edge[data-handle="w"],
.image-editor-crop-handle.is-edge[data-handle="e"] {
  width: 6px; height: 22px;
}
.image-editor-dock {
  position: relative; z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: max-content;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0;
  flex: none;
}
.image-editor-bar-btn {
  appearance: none; border: 0; background: transparent; color: #fff;
  font: inherit; font-size: 18px; font-weight: 650; letter-spacing: .01em;
  padding: 12px 4px; cursor: pointer;
  white-space: nowrap; flex: none; line-height: 1.2;
}
.image-editor-bar-btn.is-primary { color: var(--accent, #3b82f6); }
.image-editor-tools-cluster {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; flex: none;
}
.image-editor-toolbar {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 8px 12px; border-radius: 999px;
  background: #fff; box-shadow: 0 8px 28px rgba(0,0,0,.28);
}
.image-editor-tool {
  appearance: none; border: 0; background: transparent; color: #1a1d26;
  width: 52px; height: 48px; border-radius: 999px; cursor: pointer;
  display: grid; place-items: center; padding: 0;
}
.image-editor-tool:hover { background: #f2f4f7; }
.image-editor-tool.is-active {
  background: color-mix(in srgb, var(--accent, #3b82f6) 16%, #fff);
  color: var(--accent, #3b82f6);
}
.image-editor-tool svg { display: block; width: 26px; height: 26px; }
.image-editor-palette {
  display: inline-flex; flex-direction: row; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 999px;
  background: #fff; box-shadow: 0 8px 28px rgba(0,0,0,.28);
}
.image-editor-palette.hidden { display: none !important; }
.image-editor-palette-row {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
}
.image-editor-palette-row.hidden { display: none !important; }
.image-editor-history-btn {
  appearance: none; border: 0; cursor: pointer; padding: 0;
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: #fff; color: #1a1d26; box-shadow: 0 8px 28px rgba(0,0,0,.28);
}
.image-editor-history-btn:disabled { opacity: .45; cursor: default; }
.image-editor-history-btn:not(:disabled):active { background: #f2f4f7; }
.image-editor-color {
  appearance: none; border: 1px solid #d8dbe3; width: 30px; height: 30px;
  border-radius: 8px; cursor: pointer; padding: 2px; box-sizing: border-box;
  background:
    linear-gradient(var(--editor-swatch, #1a1d26), var(--editor-swatch, #1a1d26)) content-box,
    #fff;
}
.image-editor-color.is-active {
  border-color: #1a1d26;
  box-shadow: 0 0 0 2px color-mix(in srgb, #1a1d26 28%, transparent);
}
.image-editor-color.is-light {
  border-color: #c5c8ce;
}
.msg-voice {
  display: flex; align-items: center; gap: 10px; margin: 4px 0 2px; min-width: 180px; max-width: 280px;
}
.msg-voice-play {
  width: 36px; height: 36px; border: none; border-radius: 50%; flex: none;
  background: var(--accent); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0;
}
.msg.mine .msg-voice-play { background: rgba(0,0,0,.55); }
.msg-voice-play svg { width: 18px; height: 18px; display: block; }
.msg-voice-wave {
  flex: 1; display: flex; align-items: center; gap: 2px; height: 28px; min-width: 0;
}
.msg-voice-bar {
  width: 3px; border-radius: 2px; background: rgba(0,0,0,.22); flex: none;
  transition: background .15s ease;
}
.msg.mine .msg-voice-bar { background: rgba(0,0,0,.28); }
.msg-voice-bar.on { background: var(--accent); }
.msg.mine .msg-voice-bar.on { background: rgba(0,0,0,.65); }
.msg-voice-time {
  flex: none; font-size: calc(12px * var(--text-scale, 1)); color: #8b8e98; font-variant-numeric: tabular-nums; min-width: 2.4em;
}
.msg-video-note {
  position: relative; width: 200px; height: 200px; margin: 4px 0 2px;
  border-radius: 50%; overflow: hidden; cursor: pointer; background: #111;
  box-shadow: 0 0 0 2px rgba(0,0,0,.06);
}
.msg-video-note video {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transform: scaleX(-1);
}
.msg-video-note-play {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(0,0,0,.28); color: #fff; pointer-events: none;
  transition: opacity .15s ease;
}
.msg-video-note.is-playing .msg-video-note-play { opacity: 0; }
.msg-video-note.is-broken .msg-video-note-play {
  opacity: 1;
  background: rgba(0,0,0,.45);
  font-size: 28px;
  font-weight: 700;
}
.msg-video-note-play svg { width: 42px; height: 42px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.35)); }
.msg-video-note-dur {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  font-size: 12px; font-weight: 600; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.55);
  font-variant-numeric: tabular-nums; pointer-events: none;
}
.circle-record {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px;
  pointer-events: none;
}
.circle-record.hidden { display: none !important; }
.circle-record-backdrop {
  position: absolute; inset: 0; background: rgba(12, 16, 24, .72); backdrop-filter: blur(6px);
}
.circle-record-panel {
  position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 18px;
  width: min(100%, 360px);
}
.circle-record-stage {
  position: relative; width: min(72vw, 280px); height: min(72vw, 280px);
}
.circle-record-video {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
  background: #1a1f2a; transform: scaleX(-1); display: block;
}
.circle-record-ring {
  position: absolute; inset: -6px; border-radius: 50%;
  border: 3px solid #e25555; pointer-events: none;
  animation: voice-pulse 1.1s ease-in-out infinite;
}
.circle-record-meta {
  display: flex; flex-direction: column; align-items: center; gap: 4px; color: #fff;
}
.circle-record-time {
  font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.circle-record-hint { font-size: 13px; color: rgba(255,255,255,.72); }
.media-preview {
  position: fixed; inset: 0; z-index: 85; display: grid; place-items: center; padding: 24px;
}
.media-preview.hidden { display: none !important; }
.media-preview-backdrop {
  position: absolute; inset: 0; background: rgba(12, 16, 24, .72); backdrop-filter: blur(6px);
}
.media-preview-panel {
  position: relative; z-index: 1; width: min(100%, 360px);
  background: #fff; border-radius: 16px; padding: 20px 18px 16px;
  box-shadow: 0 18px 48px rgba(0,0,0,.28);
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
/* Circle preview: no white card — just the circle over the dimmed backdrop. */
.media-preview.is-circle .media-preview-panel {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 12px 8px;
}
.media-preview-body {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.media-preview-voice {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.media-preview-voice audio { width: 100%; }
.media-preview-label {
  font-size: 14px; font-weight: 600; color: #1f2430; text-align: center;
}
.media-preview.is-circle .media-preview-label {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .45);
}
.media-preview-circle {
  width: min(70vw, 240px); height: min(70vw, 240px); border-radius: 50%; overflow: hidden;
  background: #111; box-shadow: 0 0 0 2px rgba(255, 255, 255, .22);
}
.media-preview-circle video {
  width: 100%; height: 100%; object-fit: cover; display: block; transform: scaleX(-1);
}
.media-preview-actions {
  display: flex; gap: 10px; width: 100%;
}
.media-preview-actions .btn { flex: 1; }
/* Circle actions: muted gray default, white + blue accent on hover/press. */
.media-preview.is-circle .media-preview-actions .btn,
.media-preview.is-circle .media-preview-actions .btn.primary {
  background: #95a0ba;
  color: #fff;
  border: 1px solid transparent;
  box-shadow: none;
}
.media-preview.is-circle .media-preview-actions .btn:hover,
.media-preview.is-circle .media-preview-actions .btn:focus-visible,
.media-preview.is-circle .media-preview-actions .btn:active,
.media-preview.is-circle .media-preview-actions .btn.primary:hover,
.media-preview.is-circle .media-preview-actions .btn.primary:focus-visible,
.media-preview.is-circle .media-preview-actions .btn.primary:active {
  background: #fff;
  color: var(--accent, #1c58d9);
  border-color: #d0d5e0;
}
.composer-hint { display: none !important; }

.rhs {
  width: 280px;
  background: var(--glass-panel-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  border-left: var(--glass-border);
  display: flex; flex-direction: column; min-height: 0;
}
.rhs.sheet {
  position: fixed; top: 0; right: 0; bottom: 0; left: auto; width: 380px; max-width: 100%;
  background: var(--glass-panel-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  color: var(--text-strong); z-index: 25;
  box-shadow: -12px 0 32px rgba(0,0,0,.08);
}
/* Desktop: profile card sits in the layout so the chat shrinks to its left edge; keep the shadow. */
@media (min-width: 801px) {
  .app.profile-open .rhs.sheet {
    position: relative;
    inset: auto;
    width: 360px;
    max-width: 42vw;
    flex: 0 0 360px;
    z-index: 5;
    border-left: none;
    box-shadow: -12px 0 32px rgba(0,0,0,.18);
  }
  .app.profile-open .main {
    flex: 1 1 auto;
    min-width: 0;
  }
}
.rhs-backdrop { display: none; }
.rhs-head {
  height: 56px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px 0 16px;
  border-bottom: 1px solid rgba(216, 216, 220, 0.7);
  background: transparent;
  font-weight: 700;
}
.rhs-list { overflow: auto; flex: 1; }
.rhs-label { font-size: 12px; font-weight: 700; letter-spacing: .04em; color: #8b8e98; padding: 12px 16px 4px; text-transform: uppercase; }
.member {
  width: 100%; display: flex; gap: 10px; align-items: center; padding: 8px 16px;
  border: none; background: transparent; text-align: left; color: inherit; cursor: pointer;
}
.member:hover, .member.selected { background: var(--accent-soft); }
.member-meta { display: flex; flex-direction: column; min-width: 0; }
.member-name { font-weight: 700; font-size: 14px; }
.member-sub, .browse-topic { color: #8b8e98; font-size: 12px; }
.role {
  display: inline-flex; align-items: center; flex: none;
  font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; line-height: 1.5;
}
.role-admin { background: #f3e2b3; color: #6a4b00; }
.role-manager { background: var(--mention-bg); color: var(--text-strong); }
.role-user { background: #eceef3; color: #4b5160; }
.rhs-foot { padding: 12px 16px; border-top: 1px solid #ebebeb; }

.channel-card {
  display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden;
  background: transparent;
}
.channel-card.hidden { display: none !important; }
.channel-card-hero {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 18px 18px 14px;
  margin: 0;
}
.channel-card-hash {
  color: #9aa0a6; font-size: 22px; font-weight: 500; line-height: 1.15; flex: none;
}
.channel-card-hero-text { min-width: 0; flex: 1; }
.channel-card-hero-text h2 {
  margin: 0; font-size: 20px; font-weight: 700; color: #2c3038; line-height: 1.2;
  word-break: break-word;
}
.channel-card-hero-text p {
  margin: 4px 0 0; font-size: 13px; color: #8b8e98; line-height: 1.35;
  word-break: break-word;
}
.channel-rail-tools {
  margin: 0 14px 10px;
  width: auto;
  max-width: none;
  box-sizing: border-box;
}
.channel-card-section-label {
  padding: 8px 18px 4px; font-size: 15px; color: #6b707a; font-weight: 500;
}
.channel-card-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 16px 12px;
}
.channel-card-count { color: #8b8e98; font-size: 13px; }
.channel-card-actions { display: flex; gap: 8px; flex: none; }
.channel-card-add {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent); color: #fff; border: none; border-radius: 6px;
  padding: 7px 12px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.channel-card-add:hover { background: var(--accent-hover); }
.channel-card-add.hidden { display: none !important; }
.channel-card-members { overflow: auto; flex: 1; padding-bottom: 16px; }
.channel-card-group {
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: #9aa0a6; padding: 14px 18px 6px;
}
.channel-card-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px 8px 16px; min-height: 48px;
}
.channel-card-row:hover { background: rgba(255, 255, 255, 0.35); }
.channel-card-row .avatar { width: 36px; height: 36px; font-size: 13px; flex: none; }
.channel-card-meta { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.channel-card-name {
  font-weight: 600; font-size: 14px; color: #2c3038;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.channel-card-handle {
  font-size: 12px; color: #8b8e98;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.channel-card-role {
  appearance: none; border: none; background: transparent; cursor: pointer;
  color: var(--accent); font-size: 13px; font-weight: 500; padding: 4px 2px;
  display: inline-flex; align-items: center; gap: 2px; flex: none; max-width: 140px;
}
.channel-card-role:disabled {
  cursor: default; opacity: 1; color: var(--accent);
}
.channel-card-role .chevron {
  width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 5px solid currentColor; margin-left: 2px;
}
.channel-card-role-wrap { position: relative; flex: none; }
.channel-card-role-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 6;
  min-width: 160px; background: #fff; border: 1px solid #ebebeb; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 4px; 
}
.channel-card-role-menu.hidden { display: none !important; }
.channel-card-role-menu button {
  width: 100%; border: none; background: transparent; text-align: left;
  padding: 8px 10px; border-radius: 6px; font-size: 13px; color: #2c3038; cursor: pointer;
}
.channel-card-role-menu button:hover { background: var(--accent-soft); }
.channel-card-role-menu button.is-active { color: var(--accent); font-weight: 600; }
.channel-card-remove {
  appearance: none; border: none; background: transparent; color: #a0a3ab;
  width: 28px; height: 28px; border-radius: 6px; cursor: pointer; flex: none;
  font-size: 18px; line-height: 1; display: grid; place-items: center;
}
.channel-card-remove:hover { background: #f0f1f4; color: #d24b4e; }
.channel-card-remove.hidden { display: none !important; }
.channel-card-empty { color: #8b8e98; font-size: 13px; padding: 12px 18px; }

.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex;
  align-items: center; justify-content: center; z-index: 20; padding: 16px;
}
.dialog {
  width: 480px; max-width: 100%; background: #fff; border-radius: 8px;
  box-shadow: 0 16px 50px rgba(0,0,0,.3); max-height: calc(100% - 32px); overflow: auto;
}
.poll-dialog {
  width: min(440px, 100%);
}
.poll-dialog .polls-composer {
  margin-bottom: 0;
}
.poll-dialog .dialog-body {
  padding-top: 4px;
}
.poll-dialog .polls-setting {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  margin: 0 !important;
  padding: 8px 0;
  font-size: calc(13px * var(--text-scale, 1));
  font-weight: 400;
  line-height: 1.25;
  min-height: 34px;
}
.poll-dialog .polls-setting-label {
  flex: 1;
  min-width: 0;
  font-weight: 400;
  display: flex;
  align-items: center;
  line-height: 1.25;
}
.poll-dialog .polls-setting input[type="checkbox"] {
  position: absolute !important;
  opacity: 0 !important;
  width: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  pointer-events: none;
}
.poll-dialog .polls-toggle-ui {
  flex: 0 0 42px;
  width: 42px;
  height: 24px;
  margin-left: auto;
  align-self: center;
}
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 12px 4px 16px; }
.dialog-head h2 { margin: 0; font-size: 18px; }
.dialog-body { padding: 8px 16px 16px; }
.dialog-body label { display: block; margin: 12px 0 4px; font-size: 13px; font-weight: 700; }
.dialog-body input { width: 100%; }
.dialog-body .checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}
.dialog-body .checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex: none;
  accent-color: var(--accent, #1c58d9);
}
.dialog-body .checkbox-row label {
  margin: 0;
  font-weight: 600;
  cursor: pointer;
}
.dialog-body .hint {
  text-align: left;
  margin: 6px 0 0;
  font-size: 12px;
}
.hash.is-private { /* styled with .ico-lock */ }

.dialog.confirm-dialog {
  width: min(340px, 100%);
  border-radius: 16px;
  background: #f4f4f5;
  box-shadow: 0 12px 40px rgba(0,0,0,.28);
}
.confirm-dialog-body { padding: 22px 18px 16px; text-align: center; }
.confirm-dialog-body h2 {
  margin: 0 0 16px; font-size: 17px; font-weight: 700; color: #1c1f26; line-height: 1.3;
}
.confirm-check {
  display: flex; align-items: center; gap: 10px; justify-content: flex-start;
  margin: 0 4px 18px; cursor: pointer; text-align: left; font-weight: 400;
}
.confirm-check input {
  position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none;
}
.confirm-check-mark {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  border: 2px solid #c5c8ce; background: #fff;
  display: grid; place-items: center;
}
.confirm-check-mark::after {
  content: ""; width: 10px; height: 6px; border: 2px solid #fff;
  border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px);
  opacity: 0;
}
.confirm-check input:checked + .confirm-check-mark {
  background: var(--accent); border-color: var(--accent);
}
.confirm-check input:checked + .confirm-check-mark::after { opacity: 1; }
.confirm-check-text { font-size: 15px; color: #1c1f26; line-height: 1.3; }
.confirm-dialog-actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.confirm-dialog-actions .btn {
  border-radius: 12px; padding: 12px 10px; font-size: 15px; font-weight: 600;
  border: none;
}
.confirm-dialog-actions .confirm-cancel {
  background: #e6e7ea; color: #2c3038;
}
.confirm-dialog-actions .confirm-cancel:hover { background: #dcdee2; }
.confirm-dialog-actions .confirm-ok {
  background: var(--accent); color: #fff;
}
.confirm-dialog-actions .confirm-ok:hover { background: var(--accent-hover); }
.browse-list { max-height: 360px; overflow: auto; margin-top: 8px; }
.forward-dialog .dialog-body { display: flex; flex-direction: column; gap: 8px; }
.forward-list { max-height: min(42vh, 320px); margin-top: 0; }
.forward-target { width: 100%; text-align: left; }
.forward-channel-mark {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: #eef0f4; color: #5b6170; font-weight: 700; flex: 0 0 auto;
}
.forward-share-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin-top: 4px; padding: 12px 14px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: #fff;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
}
.forward-share-btn:hover { background: var(--accent-soft); }
.forward-share-btn:disabled {
  opacity: 0.65; cursor: wait;
}
.forward-share-btn svg { width: 18px; height: 18px; flex: 0 0 auto; }
.browse-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid #f0f0f0;
}
.browse-info { min-width: 0; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #2a2d34; color: #fff; padding: 10px 16px; border-radius: 6px; z-index: 40; font-size: 14px;
}
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input:focus-visible, textarea:focus-visible {
  outline: 2px solid #d5d8de; outline-offset: 0; background: #f4f5f7;
}
.composer textarea:focus-visible,
.composer .composer-rich:focus-visible { outline: none; background: transparent; }

.menu-toggle { display: none; }
.nav-backdrop { display: none; }
.menu-drawer-backdrop { display: none; }

@media (max-width: 800px) {
  /* Denser SVG doodle tile on phones (same asset as desktop; JS tints via data-URL). */
  html {
    --wallpaper-tile: 200px;
  }
  /* Extensions live under DMs in the main channel list on mobile. */

  

  
  .app.mail-mode:not(.settings-open) #chat-nav {
    display: block;
  }
  .app.mail-mode:not(.settings-open) #mail-nav {
    display: block;
  }
  .app.mail-mode:not(.settings-open) #filter,
.app.mail-mode:not(.settings-open) #channels-section-head,
.app.mail-mode:not(.settings-open) #channel-actions,
.app.mail-mode:not(.settings-open) #channel-list,
.app.mail-mode:not(.settings-open) #dm-section-head,
.app.mail-mode:not(.settings-open) #dm-list,
.app.mail-mode:not(.settings-open) #chat-tools {
    display: none !important;
  }
  /* Do NOT paint html/body with --sidebar here: that dark blue flashes
     under the soft keyboard. Keep the shared wallpaper paint from above. */
  .app {
    background: transparent;
    min-height: 100%;
    min-height: 100dvh;
  }
  @supports (min-height: -webkit-fill-available) {
    .app { min-height: -webkit-fill-available; }
  }
  .team-rail { display: none; }
  /* Personal/tool pages: one edge-to-edge glass card over wallpaper. */
  .feature-screen {
    position: fixed;
    inset: 0;
    z-index: 20;
    width: 100%;
    height: 100%;
    min-height: 100%;
    min-height: 100dvh;
    background: transparent;
    padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
    justify-content: flex-start;
    align-items: stretch;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  .app.rail-feature-open.feature-chrome-open .channel-header {
    position: fixed;
    top: env(safe-area-inset-top, 0px);
    left: 12px;
    right: 12px;
    z-index: 25;
    margin: 8px 0 0;
    padding-left: 12px;
  }
  .app.rail-feature-open.mail-mode.feature-chrome-open .channel-header {
    left: 18px;
    right: 18px;
    margin: 0;
    padding: 6px 8px 6px 6px;
    gap: 0 8px;
    min-height: 60px;
    align-items: center;
    align-content: center;
  }
  .app.rail-feature-open.feature-chrome-open #feature-screen {
    padding-top: calc(env(safe-area-inset-top, 0px) + var(--chat-scroll-top, 76px) + 10px);
    padding-left: 0;
    padding-right: 0;
  }
  .app.rail-feature-open.mail-mode:not(.mail-dialog-open) .composer-wrap {
    display: none !important;
  }
  .app.rail-feature-open.mail-mode.feature-chrome-open #feature-screen {
    top: 0;
    left: 18px !important;
    right: 18px !important;
    width: auto !important;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    height: auto;
    min-height: 0;
    padding-top: calc(env(safe-area-inset-top, 0px) + var(--chat-scroll-top, 76px) + 10px);
    padding-bottom: 4px;
    padding-left: 0 !important;
    padding-right: 0 !important;
    overflow: hidden;
  }
  .app.mail-mode .feature-card {
    min-height: 0;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    border: none;
    padding: 0;
    background: transparent;
    box-shadow: none;
  }
  @supports (min-height: -webkit-fill-available) {
    .feature-screen { min-height: -webkit-fill-available; }
  }
  .feature-card {
    width: 100%;
    max-width: 100%;
    min-height: 100%;
    border-radius: 0;
    border: 0;
    box-shadow: none;
    padding: 8px 16px 28px;
    align-self: stretch;
    box-sizing: border-box;
    background: var(--glass-tools-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
  }
  #dialogue-overlay.dialogue-overlay,
  #notif-center.notif-center {
    padding:
      calc(var(--chat-scroll-top, 76px) + 10px)
      12px
      calc(var(--chat-overlay-bottom, 48px) + 6px);
  }
  .dialogue-card {
    width: min(720px, 100%);
  }
  .feature-back {
    width: 44px; height: 44px; margin: 0 0 2px -8px;
  }
  .sidebar-footer { display: flex; }
  .sidebar-me-btn { display: inline-flex; }
  .sidebar-team-mark {
    display: grid;
    place-items: center;
  }
  .sidebar-logout {
    display: grid;
  }
  .me-bar:hover .user-menu { display: none; }
  .me-bar.menu-open .user-menu {
    display: block;
    position: fixed;
    left: 8px;
    right: auto;
    bottom: calc(78px + env(safe-area-inset-bottom, 0px));
    top: auto;
    width: min(86vw, 304px);
    max-height: calc(100% - 96px);
    z-index: 30;
  }
  .sidebar {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: none;
    height: auto;
    max-height: 100%;
    min-height: 0;
    z-index: 8;
    transform: none;
    transition: transform .32s cubic-bezier(.22,.61,.36,1);
    box-shadow: none;
    background: color-mix(in srgb, var(--sidebar) var(--glass-menu-mix, 86%), transparent);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    /* inset:0 already fills the visible viewport. Extra min-height (100lvh /
       fill-available) grows past the screen and clips the profile row on
       tall iPhones (16 / 18 Pro Max). */
    padding-bottom: 0;
    box-sizing: border-box;
  }
  /* Home-screen PWA: -webkit-fill-available stops above the home indicator,
     so html/body wallpaper (#d0e7f5) peeks as a light strip. Paint the list
     navy through that band, and stretch chat wallpaper over it. */
  html.ios-standalone:not(.app-chat-open),
  html.ios-standalone:not(.app-chat-open) body {
    background-color: var(--sidebar, #1e325c) !important;
    background-image: none !important;
  }
  html.ios-standalone .sidebar {
    bottom: 0;
  }
  html.ios-standalone.app-chat-open,
  html.ios-standalone.app-chat-open body {
    background-size: cover !important;
  }
  html.ios-standalone .chat-wallpaper,
  html.ios-standalone .app.chat-open .chat-wallpaper {
    min-height: 100lvh !important;
    height: max(100lvh, var(--wallpaper-lock-h, 100lvh)) !important;
  }
  .sidebar-footer {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    width: 100%;
    box-sizing: border-box;
  }
  /* iOS often reports 0 inset in Safari/PWA; 34px is the home-indicator floor. */
  html.ios-device .sidebar-footer {
    padding-bottom: calc(12px + max(34px, env(safe-area-inset-bottom, 0px)));
  }
  .sidebar-footer .sidebar-me-row {
    display: flex;
    flex: 0 0 auto;
    width: 100%;
    align-items: center;
    gap: 2px;
  }
  .sidebar-footer .sidebar-me-btn {
    display: inline-flex;
    flex: 1 1 auto;
    width: auto;
    max-width: none;
    min-width: 0;
  }
  .sidebar-footer .sidebar-me-name {
    max-width: none;
    flex: 1 1 auto;
  }
  /* Tools live in the profile card on mobile. */
  .sidebar-footer .sidebar-rail-tools { display: none !important; }
  /* Settings menu opened from profile → larger type on phone. */
  #settings-nav .section-head > span:first-child {
    font-size: calc(14px * var(--text-scale, 1));
  }
  #settings-nav .nav-item {
    font-size: calc(17px * var(--text-scale, 1));
    padding: 10px 12px;
    gap: 12px;
    min-height: 44px;
  }
  #settings-nav .nav-item svg {
    width: 22px;
    height: 22px;
  }
  #accounts-nav .nav-item {
    font-size: calc(17px * var(--text-scale, 1));
    padding: 10px 12px;
    gap: 12px;
    min-height: 44px;
  }
  #accounts-nav .nav-item svg {
    width: 22px;
    height: 22px;
  }
  .app.chat-open .sidebar {
    transform: translateX(-100%);
    pointer-events: none;
    z-index: 20;
    transition: transform .32s cubic-bezier(.22,.61,.36,1);
    will-change: transform;
    box-shadow: none;
  }
  .app.chat-open.menu-drawer-open .sidebar,
  .app.chat-open.menu-dragging .sidebar {
    pointer-events: auto;
    box-shadow: 12px 0 32px rgba(0,0,0,.22);
  }
  .app.chat-open.menu-drawer-open .sidebar {
    transform: translate3d(0, 0, 0);
  }
  .app.chat-open .sidebar.is-dragging {
    transition: none;
  }
  .app.chat-open .sidebar.is-settling {
    transition: transform .32s cubic-bezier(.22,.61,.36,1);
  }
  /* iOS: pin shell; never allow horizontal document pan (white gutter). */
  html.ios-device,
  html.ios-device body {
    overflow-x: hidden !important;
    overscroll-behavior-x: none !important;
    touch-action: pan-y;
    width: 100% !important;
    max-width: 100% !important;
  }
  html.ios-device .app {
    overflow-x: hidden !important;
    overscroll-behavior-x: none !important;
    touch-action: pan-y;
    width: 100% !important;
    max-width: 100% !important;
  }
  html.ios-device .app.chat-open.menu-drawer-open .main {
    background: var(--wallpaper-color, #d0e7f5) !important;
  }
  html.ios-device .app.chat-open .sidebar {
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: none !important;
    will-change: auto;
    /* Class toggle only — CSS transition, no mid-gesture inline transforms. */
    transition: transform .32s cubic-bezier(.22,.61,.36,1);
  }
  html.ios-device .app.chat-open.menu-drawer-open .sidebar {
    transform: translate3d(0, 0, 0) !important;
  }
  html.ios-device .app.chat-open:not(.menu-drawer-open) .sidebar {
    transform: translate3d(-100%, 0, 0) !important;
  }
  .menu-drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 19;
    background: rgba(15, 23, 42, .36);
    opacity: 0;
    transition: opacity .32s ease;
    pointer-events: none;
  }
  .app.menu-drawer-open .menu-drawer-backdrop:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
  }
  .app.menu-dragging .menu-drawer-backdrop:not(.hidden) {
    transition: none;
    pointer-events: none;
  }
  /* Channels ↔ settings list: slide only while swapping (no permanent absolute layers). */
  #sidebar-scroll {
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .app.settings-nav-animating #sidebar-scroll {
    overflow: hidden;
  }
  .app.settings-nav-animating #chat-nav,
  .app.settings-nav-animating #settings-nav {
    will-change: transform;
  }
  .app.settings-open.settings-nav-prep #chat-nav,
  .app.settings-open.settings-nav-exit #chat-nav {
    display: block !important;
  }
  .app.settings-open.settings-nav-prep #settings-nav,
  .app.settings-open.settings-nav-exit #settings-nav {
    display: block !important;
  }
  .app.settings-open.settings-nav-prep #chat-nav {
    transform: none;
  }
  .app.settings-open.settings-nav-prep #settings-nav {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    width: 100%;
    transform: translate3d(100%, 0, 0);
    z-index: 2;
  }
  .app.settings-open.settings-nav-animating:not(.settings-nav-prep) #chat-nav {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    width: 100%;
    transform: translate3d(-28%, 0, 0);
    opacity: 0;
    pointer-events: none;
    transition: transform .32s cubic-bezier(.22,.61,.36,1), opacity .28s ease;
  }
  .app.settings-open.settings-nav-animating:not(.settings-nav-prep) #settings-nav {
    position: relative;
    transform: none;
    transition: transform .32s cubic-bezier(.22,.61,.36,1);
  }
  .app.settings-open.settings-nav-exit #chat-nav {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    width: 100%;
    transform: none;
    opacity: 1;
    transition: transform .32s cubic-bezier(.22,.61,.36,1), opacity .28s ease;
  }
  .app.settings-open.settings-nav-exit #settings-nav {
    position: relative;
    transform: translate3d(100%, 0, 0);
    transition: transform .32s cubic-bezier(.22,.61,.36,1);
  }
  .nav-backdrop { display: none !important; }
  .menu-toggle { display: grid; }
  .settings-menu {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    margin: 0 0 2px -8px;
    padding: 0;
    color: var(--text-strong);
    justify-self: start;
    border-radius: 10px;
  }
  .settings-menu svg {
    width: 22px;
    height: 22px;
    display: block;
    margin: 0;
  }
  /* Settings list must not be covered by the detail panel. */
  .app.settings-open:not(.chat-open):not(.settings-detail-exit) #admin-screen,
  .app.settings-open:not(.settings-detail-open):not(.settings-detail-exit) #admin-screen {
    display: none !important;
  }
  /* Full-screen settings detail — cover wallpaper and chat chrome. */
  .app.settings-detail-open #admin-screen:not(.hidden),
  .app.settings-open.chat-open #admin-screen:not(.hidden),
  .app.settings-detail-exit #admin-screen:not(.hidden) {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    inset: 0 !important;
    z-index: 40 !important;
    width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    min-height: 100% !important;
    min-height: 100dvh !important;
    max-height: none !important;
    background: #fff !important;
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding: calc(12px + env(safe-area-inset-top, 0px)) 16px calc(32px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    transform: translate3d(0, 0, 0);
    transition: transform .32s cubic-bezier(.22,.61,.36,1);
  }
  .app.settings-detail-exit #admin-screen:not(.hidden) {
    transform: translate3d(100%, 0, 0);
    pointer-events: none;
  }
  .app.settings-detail-enter #admin-screen:not(.hidden) {
    transform: translate3d(100%, 0, 0);
    transition: none;
  }
  .app.settings-detail-enter.settings-detail-enter-active #admin-screen:not(.hidden) {
    transform: translate3d(0, 0, 0);
    transition: transform .32s cubic-bezier(.22,.61,.36,1);
  }
  /* Do not set height: -webkit-fill-available on this overlay: iOS can
     compute it as 0 and you get a blank white screen over the app. */
  .app.settings-open.chat-open #admin-screen:not(.hidden):not(:has([data-panel]:not(.hidden))) {
    display: none !important;
  }
  .app.settings-detail-open .chat-wallpaper,
  .app.settings-open.chat-open .chat-wallpaper {
    display: none !important;
    visibility: hidden !important;
  }
  .app.settings-detail-open .settings-card,
  .app.settings-open.chat-open .settings-card {
    width: 100%;
    max-width: 100%;
    min-height: 100%;
    flex: 1 0 auto;
    overflow-x: hidden;
    box-sizing: border-box;
    border-radius: 0;
    box-shadow: none;
    align-self: stretch;
    background: #fff;
    display: flex;
    flex-direction: column;
  }
  .app.settings-detail-open #admin-actions,
  .app.settings-open.chat-open #admin-actions,
  html.capacitor-android .app.settings-open #admin-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin-top: auto;
    padding-top: 12px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    background: #fff;
  }
  .settings-card h1 { font-size: calc(26px * var(--text-scale, 1)); line-height: 1.2; }
  /* Settings list (screen 5): hide profile row. */
  .app.settings-open .sidebar-footer,
  .app.settings-open #sidebar-footer {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
    pointer-events: none !important;
  }
  /* To-chat chevron removed from mobile. */
  .sidebar-to-chat {
    display: none !important;
  }
  .settings-panel-sub {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .for-all-head {
    display: none; /* label lives on each mobile for-all toggle */
  }
  /* Appearance (mobile only): in-card toggles with «Для всех» above each switch. */
  [data-panel="appearance"] .settings-panel-sub {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  [data-panel="appearance"] .for-all-head {
    display: none !important;
  }
  [data-panel="appearance"] .appearance-row {
    position: relative;
    grid-template-columns: minmax(0, 1fr);
    column-gap: 0;
  }
  [data-panel="appearance"] .appearance-row:has(> .for-all-toggle:not(.hidden)) .appearance-row-body {
    padding-right: 70px; /* room for in-card toggle + label */
  }
  [data-panel="appearance"] .appearance-row > .for-all-toggle {
    --for-all-lift: calc(1.25em + 10px + (48px - 32px) / 2);
    position: absolute;
    top: calc(12px + var(--for-all-lift));
    right: 14px;
    width: 52px;
    min-height: 32px;
    margin: 0 !important;
    align-self: auto;
    justify-self: auto;
    z-index: 2;
    border: 0;
    background: transparent;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
  }
  [data-panel="appearance"] .appearance-row > .for-all-toggle .for-all-toggle-label {
    top: calc(-1 * var(--for-all-lift));
  }
  [data-panel="appearance"] .appearance-row-tall > .for-all-toggle {
    margin-top: 0 !important;
  }
  .notify-row {
    grid-template-columns: minmax(0, 1fr);
    column-gap: 0;
    row-gap: 8px;
  }
  .cal-pref-line {
    grid-template-columns: minmax(0, 1fr);
    column-gap: 0;
    row-gap: 8px;
  }
  .notify-row > .for-all-toggle,
.cal-pref-line > .for-all-toggle {
    width: 100%;
    min-height: 48px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid #ebebeb;
    border-radius: 10px;
    background: #fafbfc;
    justify-self: stretch;
  }

  
  .settings-card .plugin-card label.settings-toggle {
    padding: 6px 0 !important;
    min-height: 0 !important;
  }
  .notify-row > .for-all-toggle .for-all-toggle-label,
.cal-pref-line > .for-all-toggle .for-all-toggle-label {
    display: block;
    flex: 1;
    min-width: 0;
    font-size: calc(14px * var(--text-scale, 1));
    font-weight: 700;
    color: var(--text-strong);
  }
  .notify-row > .for-all-toggle .settings-toggle-ui,
.cal-pref-line > .for-all-toggle .settings-toggle-ui,
.settings-card .notify-row > .for-all-toggle .settings-toggle-ui,
.settings-card .cal-pref-line > .for-all-toggle .settings-toggle-ui,
[data-panel="appearance"] .appearance-row > .for-all-toggle .settings-toggle-ui,
.settings-card [data-panel="appearance"] .appearance-row > .for-all-toggle .settings-toggle-ui {
    width: 52px;
    height: 32px;
    flex: none;
  }
  .notify-row > .for-all-toggle .settings-toggle-ui::after,
.cal-pref-line > .for-all-toggle .settings-toggle-ui::after,
.settings-card .notify-row > .for-all-toggle .settings-toggle-ui::after,
.settings-card .cal-pref-line > .for-all-toggle .settings-toggle-ui::after,
[data-panel="appearance"] .appearance-row > .for-all-toggle .settings-toggle-ui::after,
.settings-card [data-panel="appearance"] .appearance-row > .for-all-toggle .settings-toggle-ui::after {
    top: 3px;
    left: 3px;
    width: 26px;
    height: 26px;
  }
  .notify-row > .for-all-toggle input:checked + .settings-toggle-ui::after,
.cal-pref-line > .for-all-toggle input:checked + .settings-toggle-ui::after,
.settings-card .notify-row > .for-all-toggle input:checked + .settings-toggle-ui::after,
.settings-card .cal-pref-line > .for-all-toggle input:checked + .settings-toggle-ui::after,
[data-panel="appearance"] .appearance-row > .for-all-toggle input:checked + .settings-toggle-ui::after,
.settings-card [data-panel="appearance"] .appearance-row > .for-all-toggle input:checked + .settings-toggle-ui::after {
    transform: translateX(20px);
  }
  .settings-card label.settings-toggle {
    min-height: 52px;
    padding: 16px;
    gap: 16px;
  }
  .settings-card .settings-toggle-ui {
    flex: 0 0 52px;
    width: 52px;
    height: 32px;
  }
  .settings-card .settings-toggle-ui::after {
    top: 3px;
    left: 3px;
    width: 26px;
    height: 26px;
  }
  .settings-card label.settings-toggle input:checked + .settings-toggle-ui::after {
    transform: translateX(20px);
  }
  .settings-avatar-block { display: flex; }
  .menu-toggle .menu-ico-list { display: none; }
  .menu-toggle .menu-ico-back { display: block; }
  .main { width: 100%; min-width: 0; min-height: 0; overflow: hidden; }
  /* Startup splash only — sidebar/rail stay at the default .team-mark size. */
  .boot .team-mark,
  #boot-team-mark {
    width: 112px;
    height: 112px;
    border-radius: 50%;
    font-size: 36px;
  }
  .boot .team-mark.has-logo,
  #boot-team-mark.has-logo {
    background: transparent;
    box-shadow: none;
  }
  /* Fixed wallpaper layer: size is frozen in px by JS so keyboard resize
     cannot reflow background-size:cover (no squash). Stays behind chrome;
     soft keyboard overlays this paint — never expose sidebar blue. */
  .chat-wallpaper {
    position: fixed;
    inset: auto;
    top: 0;
    left: 0;
    right: auto;
    bottom: auto;
    width: var(--wallpaper-lock-w, 100vw);
    height: var(--wallpaper-lock-h, 100lvh);
    min-height: 100lvh;
    min-height: 100dvh;
    z-index: 0;
    background-size: cover !important;
    background-position: center top !important;
  }
  html[data-wallpaper="custom"] .chat-wallpaper {
    background-size: var(--wallpaper-size-mobile, cover) !important;
    background-position: var(--wallpaper-pos-mobile, center center) !important;
  }
  html[data-wallpaper="space"] .chat-wallpaper {
    background-size: var(--wallpaper-size-mobile, cover), cover !important;
    background-position: var(--wallpaper-pos-mobile, center center), center !important;
  }
  /* Keep html/body wallpaper crop identical to the locked layer so the
     status-bar strip never falls back to a flat/gray fill (Android). */
  html, body {
    background-size: var(--wallpaper-lock-w, 100vw) var(--wallpaper-lock-h, 100dvh) !important;
    background-position: left top !important;
  }
  html[data-wallpaper="custom"],
  html[data-wallpaper="custom"] body {
    background-size: var(--wallpaper-size-mobile, cover) !important;
    background-position: var(--wallpaper-pos-mobile, center center) !important;
  }
  html[data-wallpaper="space"],
  html[data-wallpaper="space"] body {
    background-size: var(--wallpaper-size-mobile, cover), cover !important;
    background-position: var(--wallpaper-pos-mobile, center center), center !important;
  }
  .app.chat-open .chat-wallpaper {
    top: 0 !important;
    left: 0 !important;
    width: var(--wallpaper-lock-w, 100vw) !important;
    min-width: 100vw;
    min-height: 100dvh !important;
    background-position: left top !important;
  }
  html[data-wallpaper="custom"] .app.chat-open .chat-wallpaper,
  html[data-wallpaper="space"] .app.chat-open .chat-wallpaper {
    background-position: var(--wallpaper-pos-mobile, center center) !important;
  }
  .app.chat-open .main {
    background: transparent !important;
  }
  html, body, .app {
    height: 100%;
    min-height: 100%;
    min-height: 100dvh;
  }
  .main {
    flex: 1;
    min-height: 0;
  }
  .composer-wrap {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding-top: 8px;
    padding-left: calc(12px + env(safe-area-inset-left, 0px));
    padding-right: calc(12px + env(safe-area-inset-right, 0px));
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px) + var(--kb-inset, 0px));
    background: transparent;
    z-index: 4;
    margin-top: auto;
    flex: none;
  }
  /* iOS Safari tab: bottom chrome already clears the home indicator. Extra
     safe-area padding left a tall empty strip under the composer (unlike Android).
     Keep a modest pad so mic/cam stay above the gesture edge. */
  html.ios-device.ios-browser .composer-wrap {
    padding-bottom: 12px;
  }

  /* iOS: enlarge composer icon hit targets (HIG ~44pt). */
  html.ios-device .attach-btn,
  html.ios-device .emoji-btn,
  html.ios-device .media-btn,
  html.ios-device .send {
    width: max(44px, var(--chrome-icon-btn));
    height: max(44px, var(--chrome-icon-btn));
  }
  html.ios-device .media-btn::before {
    top: -12px;
    right: -10px;
    bottom: -14px;
    left: -10px;
  }

  /* ---- iOS keyboard layout (IOS_KB_LAYOUT=true in app.js) ---- */
  html.ios-device.ios-kb-layout.composer-focused,
  html.ios-device.ios-kb-layout.composer-focused body {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    overscroll-behavior: none;
  }
  html.ios-device.ios-kb-layout.composer-focused .channel-header {
    flex-shrink: 0 !important;
    position: relative;
    z-index: 12;
    transform: none !important;
  }
  html.ios-device.ios-kb-layout.composer-focused.chat-chrome-overlay .channel-header {
    position: absolute;
  }
  html.ios-device.ios-kb-layout.composer-focused .composer-wrap {
    flex-shrink: 0 !important;
  }
  html.ios-device.ios-kb-layout.ios-focus-lift #composer-input {
    transform: translateY(var(--ios-focus-lift, 0px));
    opacity: 0;
  }
  html.ios-device.ios-kb-layout.kb-vv-pin .app {
    position: fixed !important;
    top: var(--vv-top, 0px) !important;
    left: 0 !important;
    right: 0 !important;
    bottom: auto !important;
    width: 100% !important;
    height: var(--vv-height, 100%) !important;
    max-height: var(--vv-height, 100%) !important;
    min-height: 0 !important;
    overflow: hidden !important;
    transform: none !important;
  }
  html.ios-device.ios-kb-layout.kb-vv-pin .main {
    min-height: 0;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  html.ios-device.ios-kb-layout.kb-vv-pin .thread {
    flex: 1 1 auto;
    min-height: 0;
  }
  html.ios-device.ios-kb-layout.kb-vv-pin .chat-wallpaper {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: var(--wallpaper-lock-w, 100vw) !important;
    height: var(--wallpaper-lock-h, 100dvh) !important;
    min-height: var(--wallpaper-lock-h, 100dvh) !important;
    z-index: 0 !important;
  }
  html.ios-device.ios-kb-layout.kb-vv-pin.kb-open .composer-wrap {
    padding-bottom: 6px;
  }
  /* Mobile: safe-area insets on the shared glass header. */
  .channel-header {
    margin: calc(6px + env(safe-area-inset-top, 0px)) calc(12px + env(safe-area-inset-left, 0px)) 0 calc(12px + env(safe-area-inset-right, 0px));
  }
  /* iOS: keep header snug under the status bar / Dynamic Island (Android-like). */
  html.ios-device .channel-header {
    margin-top: calc(2px + env(safe-area-inset-top, 0px));
  }
  html.chat-chrome-overlay .main > .channel-header {
    top: calc(6px + env(safe-area-inset-top, 0px) + var(--chat-banner-h, 0px));
    left: calc(12px + env(safe-area-inset-left, 0px));
    right: calc(12px + env(safe-area-inset-right, 0px));
  }
  html.ios-device.chat-chrome-overlay .main > .channel-header {
    top: calc(2px + env(safe-area-inset-top, 0px) + var(--chat-banner-h, 0px));
  }
  html.chat-chrome-overlay .main > .pinned-banner:not(.hidden) {
    left: calc(12px + env(safe-area-inset-left, 0px));
    right: calc(12px + env(safe-area-inset-right, 0px));
  }
  /* Elevate chat header above messages only while chat is open.
     If always elevated, it paints over the sidebar after going back. */
  .main > .channel-header {
    z-index: 1;
  }
  .app.chat-open .main > .channel-header {
    z-index: 12;
  }
  /* Menu → chat: header drops from top, composer rises from bottom. */
  .app.chat-chrome-enter:not(.chat-chrome-enter-active) .channel-header {
    transform: translate3d(0, -110%, 0) !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: none !important;
  }
  .app.chat-chrome-enter:not(.chat-chrome-enter-active) .composer-wrap {
    transform: translate3d(0, 110%, 0) !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: none !important;
  }
  .app.chat-chrome-enter.chat-chrome-enter-active .channel-header,
  .app.chat-chrome-enter.chat-chrome-enter-active .composer-wrap {
    transform: translate3d(0, 0, 0);
    opacity: 1;
    pointer-events: auto;
    transition:
      transform var(--chat-enter-ms, 560ms) cubic-bezier(.22,.61,.36,1),
      opacity var(--chat-enter-ms, 560ms) cubic-bezier(.22,.61,.36,1);
    will-change: transform, opacity;
  }
  @media (prefers-reduced-motion: reduce) {
    .app.chat-chrome-enter:not(.chat-chrome-enter-active) .channel-header,
    .app.chat-chrome-enter:not(.chat-chrome-enter-active) .composer-wrap,
    .app.chat-chrome-enter.chat-chrome-enter-active .channel-header,
    .app.chat-chrome-enter.chat-chrome-enter-active .composer-wrap {
      transform: none !important;
      opacity: 1 !important;
      transition: none !important;
    }
  }
  .app.chat-open .channel-header .member-menu-wrap {
    z-index: 13;
  }
  .app.chat-open .channel-header .member-search-menu {
    position: absolute;
    left: auto;
    right: 0;
    top: calc(100% + 8px);
    width: min(92vw, 320px);
    max-width: min(92vw, 320px);
    z-index: 40;
    background: var(--glass-chip-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
  }
  .pinned-banner {
    margin: 6px calc(12px + env(safe-area-inset-left, 0px)) 0 calc(12px + env(safe-area-inset-right, 0px));
  }
  /* Keyboard open: only pad when --kb-inset > 0 (overlays-content).
     If the layout already resized above the keyboard, --kb-inset stays 0. */
  html.kb-open .composer-wrap {
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px) + var(--kb-inset, 0px));
  }
  /* Keep layout height stable while the soft keyboard overlays content. */
  html.kb-open,
  html.kb-open body {
    overflow: hidden;
    overscroll-behavior: none;
  }
  html.kb-open .app {
    height: 100%;
    max-height: 100%;
  }
  .composer-shell { padding: 6px 6px 6px 8px; }
  .composer textarea,
  .composer .composer-rich { font-size: 16px; }
  .composer-tools { gap: 2px; }
  .attach-btn, .emoji-btn, .media-btn, .send {
    width: var(--chrome-icon-btn);
    height: var(--chrome-icon-btn);
  }
  .icq-smiley { width: 30px; height: 30px; }
  .emoji-picker-item { font-size: 30px; }
  .emoji-picker-item.is-icq img.icq-smiley { width: 34px; height: 34px; }
  .msg.emoji-only .msg-body { font-size: 48px; }
  .msg.emoji-only.emoji-2 .msg-body { font-size: 40px; }
  .msg.emoji-only.emoji-3 .msg-body { font-size: 32px; }
  .typing { min-height: 0; padding: 0 16px; }
  .rhs { position: fixed; right: 0; top: 0; bottom: 0; z-index: 9; box-shadow: -8px 0 24px rgba(0,0,0,.15); }
  .rhs.sheet {
    position: fixed; top: 0; right: 0; bottom: 0; left: auto;
    width: min(78vw, 300px); max-width: 78vw; flex: none;
    z-index: 25; box-shadow: -12px 0 32px rgba(0,0,0,.18);
    transform: translate3d(0,0,0);
    transition: transform .32s cubic-bezier(.22,.61,.36,1);
    will-change: transform;
  }
  /* iOS: left edge shadow/border reads as a hard black strip on DM/channel cards. */
  html.ios-device .rhs,
  html.ios-device .rhs.sheet,
  html.ios-device .app.profile-open .rhs.sheet {
    border-left: none !important;
    box-shadow: none !important;
  }
  .rhs.sheet.is-dragging { transition: none; }
  .rhs.sheet.is-settling { transition: transform .32s cubic-bezier(.22,.61,.36,1); }
  .app.profile-open .rhs.sheet {
    position: fixed;
    inset: 0 0 0 auto;
    width: min(78vw, 300px);
    max-width: 78vw;
    flex: none;
  }
  .app.sheet-dragging .main,
  .app.sheet-dragging .thread {
    touch-action: pan-y;
  }
  .rhs.sheet .profile-visit {
    padding: 12px 14px 20px;
  }
  .rhs.sheet .card-avatar-wrap {
    width: 112px; height: 112px;
    min-width: 112px; min-height: 112px;
    max-width: 112px; max-height: 112px;
    flex: 0 0 112px;
  }
  .rhs.sheet .profile-visit .avatar {
    width: 100% !important; height: 100% !important;
    min-width: 0 !important; min-height: 0 !important;
    max-width: none !important; max-height: none !important;
    flex: none !important;
  }
  .rhs.sheet .card-availability {
    flex: 0 0 auto;
  }
  /* Storage is in the profile-card tools row on mobile. */
  #card-media {
    display: none !important;
  }
  .rhs-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 8;
    background: var(--glass-dim);
    opacity: 0;
    transition: opacity .28s ease;
    pointer-events: none;
  }
  .app.profile-open .rhs-backdrop:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
  }
  .app.sheet-dragging .rhs-backdrop:not(.hidden) {
    transition: none;
    pointer-events: none;
  }
}

/* Screen share (DM MVP) */
.screen-invite {
  position: fixed; left: 50%; top: 72px; transform: translateX(-50%); z-index: 40;
  max-width: min(420px, calc(100vw - 24px)); width: 100%;
  background: #fff; border: 1px solid #ebebeb; border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,.18); padding: 14px 16px;
}
.screen-invite.hidden { display: none !important; }
.screen-invite-body { display: flex; flex-direction: column; gap: 12px; }
.screen-invite-body strong { font-size: 14px; line-height: 1.4; color: var(--text-strong, #1b1d21); }
.screen-invite-actions { display: flex; justify-content: flex-end; gap: 8px; }
.screen-stage {
  position: fixed; inset: 0; z-index: 35; background: rgba(12, 14, 18, .92);
  display: flex; flex-direction: column; padding: 12px;
}
.screen-stage.hidden { display: none !important; }
/* Sharer: compact floating preview — chat stays usable underneath */
.screen-stage.is-sharer {
  inset: auto;
  right: 16px;
  bottom: 16px;
  width: min(480px, calc(100vw - 24px));
  height: min(320px, calc(100vh - 96px));
  padding: 8px;
  border-radius: 12px;
  background: rgba(18, 20, 24, .96);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .35);
  border: 1px solid rgba(255, 255, 255, .08);
}
.screen-stage.is-sharer .screen-stage-bar { padding: 2px 2px 8px; }
.screen-stage.is-sharer .screen-stage-label { font-size: 12px; }
.screen-stage.is-sharer .screen-stage-bar .btn { padding: 4px 10px; font-size: 12px; }
.screen-stage-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 4px 4px 12px; color: #fff; flex: none;
}
.screen-stage-label { font-size: 14px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.screen-video {
  flex: 1; min-height: 0; width: 100%; border-radius: 8px; background: #000;
  object-fit: contain;
}
.mobile-tour {
  position: fixed;
  inset: 0;
  z-index: 80;
}
.mobile-tour.hidden { display: none !important; }
.mobile-tour-block { position: absolute; inset: 0; }
.mobile-tour.is-gesture .mobile-tour-block { pointer-events: none; }
.mobile-tour-spot {
  position: fixed;
  z-index: 1;
  pointer-events: none;
  border-radius: 16px;
  box-shadow: 0 0 0 9999px rgba(16, 24, 40, .48);
  outline: 2px solid #fff;
}
.mobile-tour-gesture {
  position: fixed;
  z-index: 2;
  top: 42%;
  width: 56px;
  height: 56px;
  pointer-events: none;
  display: grid;
  place-items: center;
}
.mobile-tour-gesture.is-left { left: 10px; }
.mobile-tour-gesture.is-right { right: 10px; }
.mobile-tour-gesture.is-right .mobile-tour-gesture-arrow svg { transform: scaleX(-1); }
.mobile-tour-gesture-arrow {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  color: #1a1d26;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 28px rgba(16, 24, 40, .22);
}
.mobile-tour-gesture.is-left .mobile-tour-gesture-arrow { animation: tour-nudge-right 1.15s ease-in-out infinite; }
.mobile-tour-gesture.is-right .mobile-tour-gesture-arrow { animation: tour-nudge-left 1.15s ease-in-out infinite; }
@keyframes tour-nudge-right {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(18px); }
}
@keyframes tour-nudge-left {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-18px); }
}
.mobile-tour-card {
  position: fixed;
  z-index: 3;
  left: 16px;
  right: 16px;
  background: #fff;
  color: #1a1d26;
  border-radius: 22px;
  padding: 22px 20px 16px;
  box-shadow: 0 18px 50px rgba(16, 24, 40, .22);
  text-align: center;
}
.mobile-tour.is-welcome .mobile-tour-card {
  top: 50%;
  transform: translateY(-50%);
}
.mobile-tour-logo {
  width: 88px;
  height: 88px;
  margin: 0 auto 12px;
  border-radius: 50%;
  font-size: 28px;
}
.mobile-tour-card h1,
.mobile-tour-card h2 {
  margin: 0 0 8px;
  font-size: 26px;
  line-height: 1.2;
}
#mobile-tour-welcome:not([hidden]),
#mobile-tour-bye:not([hidden]) {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
#mobile-tour-welcome .btn.wide,
#mobile-tour-bye .btn.wide { width: 100%; }
#mobile-tour-heading {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  font-size: 22px;
  line-height: 1.25;
  text-align: center;
}
.mobile-tour-heading-line { display: block; }
.mobile-tour-card h2 { font-size: 20px; text-align: left; }
.mobile-tour-card p {
  margin: 0 0 14px;
  color: #5c6570;
  font-size: 15px;
  line-height: 1.4;
  text-align: left;
}
.mobile-tour-bye-lead {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 2px 0 10px !important;
  text-align: center !important;
  color: #1a1d26 !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  line-height: 1.35 !important;
}
.mobile-tour-bye-line { display: block; }
.mobile-tour-bye {
  margin: 0 0 16px !important;
  text-align: center !important;
  color: #3f4350 !important;
  font-size: 16px !important;
  line-height: 1.45 !important;
}
.mobile-tour-caption {
  margin: 16px 0 10px !important;
  text-align: center !important;
  color: #8b8e98 !important;
  font-size: 13px !important;
}
.mobile-tour-never {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  color: #1a1d26;
  font-size: 15px;
}
.mobile-tour-never input { width: 18px; height: 18px; margin: 0; }
#mobile-tour-bye .mobile-tour-never { margin-top: 18px; }
.mobile-tour-card .btn.wide { margin-top: 8px; }
.mobile-tour-card .btn.primary {
  background: color-mix(in srgb, var(--sidebar) 68%, white);
  color: #fff;
  border-color: transparent;
}
.mobile-tour-card .btn.primary:hover,
.mobile-tour-card .btn.primary:focus-visible,
.mobile-tour-card .btn.primary:active {
  background: var(--sidebar);
  color: #fff;
}
.mobile-tour-skip {
  appearance: none;
  border: 0;
  background: transparent;
  color: #5c6570;
  font: inherit;
  font-size: 15px;
  padding: 10px 8px;
  cursor: pointer;
}
.mobile-tour-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}
.mobile-tour-actions .btn { min-width: 112px; }
.mobile-tour-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 2px 0 10px;
}
.mobile-tour-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d5d8e0;
  display: block;
}
.mobile-tour-dots i.is-on { background: #3b6cff; }
@media (prefers-reduced-motion: reduce) {
  .mobile-tour-gesture-arrow { animation: none !important; }
}
@media (max-width: 560px) {
  .screen-stage.is-sharer {
    right: 8px;
    left: 8px;
    bottom: 8px;
    width: auto;
    height: min(240px, 40vh);
  }
}

/* Mail client — browser-style: folders in sidebar, list/read in main pane */
.mail-layout { display: flex; flex-direction: column; gap: 10px; min-height: 0; min-width: 0; }
.mail-layout--client {
  gap: 10px;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}
.mail-folder-heading {
  margin: 0;
  font-size: calc(13px * var(--text-scale, 1));
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #8b8e98;
}
.mail-disconnect { margin-top: 12px; }

.mail-manage-card {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  flex: 0 0 auto;
}
.mail-check {
  appearance: none;
  width: 18px;
  height: 18px;
  margin: 0;
  flex: none;
  border: 1.5px solid #c5c9d2;
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
  position: relative;
}
.mail-check:checked,
.mail-check:indeterminate {
  border-color: var(--accent, #5b6cff);
  background: var(--accent, #5b6cff);
}
.mail-check:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.mail-check:indeterminate::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 7px;
  width: 10px;
  height: 2px;
  background: #fff;
  border-radius: 1px;
}
.mail-bubbles {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}
.mail-bubble {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  margin: 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff;
  color: #2a2d35;
  font: inherit;
  font-size: calc(13px * var(--text-scale, 1));
  cursor: pointer;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(42, 45, 53, 0.08);
}
.mail-bubble:hover { background: #f7f8fa; }
.mail-bubble.is-active {
  background: #e8ebff;
  color: #2f3dbd;
  box-shadow: inset 0 0 0 1px rgba(91, 108, 255, 0.35);
}
.mail-bubble-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1a73e8;
  flex: none;
}
.mail-bubble-ico { display: block; flex: none; }
.mail-bubble-sort svg { opacity: .55; }
.mail-manage-action {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  margin: 0;
  padding: 6px 10px;
  border-radius: 8px;
  background: transparent;
  color: #6b7080;
  font: inherit;
  font-size: calc(13px * var(--text-scale, 1));
  cursor: pointer;
}
.mail-manage-action:hover:not(:disabled) { background: #f2f3f7; color: #1a1d26; }
.mail-manage-action:disabled { opacity: .45; cursor: default; }
.mail-manage-action svg { display: block; }
.mail-sort-menu {
  position: fixed;
  z-index: 80;
  min-width: 220px;
  padding: 6px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e8eaef;
  box-shadow: 0 8px 28px rgba(16, 24, 40, 0.16);
}
.mail-sort-item {
  appearance: none;
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 9px 12px;
  border-radius: 8px;
  font: inherit;
  font-size: calc(14px * var(--text-scale, 1));
  color: #1a1d26;
  cursor: pointer;
}
.mail-sort-item:hover { background: #f5f6f8; }
.mail-sort-item.is-active { font-weight: 600; }

.mail-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  flex: 1 1 auto;
  min-height: 0;
  border: 1px solid #e8eaef;
  border-radius: 14px;
  overflow: auto;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.mail-list-empty,
.mail-read,
.mail-empty-settings {
  flex: 1 1 auto;
  min-height: 0;
}
.mail-list-empty {
  border-radius: 14px;
  background: #fff;
  border: 1px solid #e8eaef;
  padding: 28px 16px;
}
.mail-row {
  appearance: none; width: 100%; border: 0; border-bottom: 1px solid #eef0f4;
  background: #fff; border-radius: 0; padding: 10px 14px; text-align: left;
  cursor: pointer; font: inherit; color: inherit;
  display: grid;
  grid-template-columns: 18px 28px minmax(100px, 170px) minmax(0, 1fr) auto;
  gap: 10px 12px;
  align-items: center;
  box-sizing: border-box;
}
.mail-row:last-child { border-bottom: 0; }
.mail-row:hover { background: #f7f8fa; }
.mail-row.is-unread { background: #fafbfd; }
.mail-row.is-selected { background: #f0f3ff; }
.mail-row.is-unread .mail-row-from,
.mail-row.is-unread .mail-row-subject { font-weight: 700; color: #1a1d26; }
.mail-row-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
  flex: none;
  user-select: none;
}
.mail-row-from {
  font-size: calc(13px * var(--text-scale, 1)); color: #1a1d26;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mail-row-main {
  display: flex; min-width: 0; gap: 4px; align-items: baseline;
  font-size: calc(13px * var(--text-scale, 1));
}
.mail-row-subject {
  color: #1a1d26; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 0 1 auto; max-width: 55%;
}
.mail-row-snippet {
  color: #8b8e98; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1 1 auto; min-width: 0;
}
.mail-row-meta {
  display: flex; gap: 8px; align-items: center; justify-content: flex-end;
  color: #9aa0ab; font-size: calc(12px * var(--text-scale, 1));
  white-space: nowrap;
}
.mail-att-mark { font-size: 12px; opacity: .75; }
.mail-flag-mark { display: inline-flex; align-items: center; }
@media (max-width: 720px) {
  .mail-row {
    grid-template-columns: 18px 28px minmax(0, 1fr) auto;
    grid-template-areas:
      "check av from meta"
      "check av main main";
    gap: 2px 10px;
  }
  .mail-row > .mail-check { grid-area: check; align-self: center; }
  .mail-row-avatar { grid-area: av; align-self: center; }
  .mail-row-from { grid-area: from; }
  .mail-row-main { grid-area: main; }
  .mail-row-meta { grid-area: meta; }
  .mail-row-subject { max-width: none; }
  .mail-bubbles { gap: 4px; }
  .mail-bubble { padding: 5px 9px; font-size: calc(12px * var(--text-scale, 1)); }
}
.mail-connect,
.mail-read:not(.mail-read--dialog) {
  display: flex; flex-direction: column; gap: 12px; max-width: none;
  padding: 14px 16px 16px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #e8eaef;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.mail-empty-settings {
  padding: 28px 16px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #e8eaef;
}
.mail-connect-form { display: flex; flex-direction: column; gap: 10px; }
.mail-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.mail-error { color: #b42318; background: #fef3f2; border-radius: 8px; padding: 10px 12px; font-size: calc(13px * var(--text-scale, 1)); }
.mail-hint { color: #8b8e98; font-size: calc(12px * var(--text-scale, 1)); }
.mail-oauth-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.mail-read-head h3 { margin: 0; font-size: calc(18px * var(--text-scale, 1)); }
.mail-read-from, .mail-read-meta { color: #6b7080; font-size: calc(13px * var(--text-scale, 1)); }
.mail-attachments { display: flex; flex-wrap: wrap; gap: 8px; }
.mail-attachments a { color: var(--accent); font-size: calc(13px * var(--text-scale, 1)); }
.mail-html-frame { width: 100%; min-height: 280px; border: 1px solid #e8eaef; border-radius: 10px; background: #fff; }
.mail-text { white-space: pre-wrap; word-break: break-word; font: inherit; margin: 0;
  padding: 12px; border: 1px solid #e8eaef; border-radius: 10px; background: #fff; }

/* Compose — same card language as polls composer */
.mail-compose {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 720px;
  align-self: flex-start;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  box-sizing: border-box;
  padding: 18px 20px 20px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid #e8eaef;
  box-shadow: 0 8px 28px rgba(16, 24, 40, 0.08);
}
.mail-compose.mail-compose--dialog {
  max-width: none;
  align-self: stretch;
  margin: 0;
  flex: 0 1 auto;
  padding: 10px 14px 12px;
  gap: 8px;
  border-radius: 0;
  background: #fff;
  border: 0;
  box-shadow: none;
}
.mail-compose-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.mail-compose-field > span {
  font-size: calc(14px * var(--text-scale, 1));
  font-weight: 700;
  color: #1f2430;
  line-height: 1.25;
}
.mail-compose-field input,
.mail-compose-field select,
.mail-compose-field textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #e4e7ec;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: calc(15px * var(--text-scale, 1));
  font-weight: 400;
  color: #1a1d26;
  background: #fff;
  line-height: 1.35;
}
.mail-compose-field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%236b7080' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}
.mail-compose-field input::placeholder,
.mail-compose-field textarea::placeholder {
  color: #9aa0ab;
}
.mail-compose-field input:focus,
.mail-compose-field select:focus,
.mail-compose-field textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, #fff);
  outline-offset: 1px;
  border-color: color-mix(in srgb, var(--accent) 40%, #d0d4dc);
}
.mail-compose-field--body {
  flex: 1 1 auto;
  min-height: 0;
}
.mail-compose-field--body textarea {
  resize: vertical;
  min-height: 180px;
  flex: 1 1 auto;
  height: 100%;
}
.mail-compose .mail-actions {
  margin-top: 2px;
  flex: 0 0 auto;
}
.mail-compose-send.btn.primary {
  min-height: 40px;
  padding: 0 18px;
  border-radius: 10px;
  font-weight: 600;
}

.mail-settings-block { margin-top: 20px; }
.mail-settings-subtitle {
  margin: 0 0 10px; font-size: calc(15px * var(--text-scale, 1)); font-weight: 700; color: #1a1d26;
}
.mail-accounts-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.mail-account-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid #e8eaef; border-radius: 12px; padding: 12px 14px; background: #fff;
}
.mail-account-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mail-account-info strong { font-size: calc(14px * var(--text-scale, 1)); }
.mail-account-info span { color: #6b7080; font-size: calc(12px * var(--text-scale, 1)); }
.mail-account-meta { color: #9aa0ab !important; }
.mail-connect-settings .settings-field { margin-bottom: 10px; }
.mail-empty-settings { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.mail-empty-settings p { margin: 0; }

.mail-preset-field { display: flex; flex-direction: column; gap: 6px; }
.mail-preset-picker { position: relative; width: 100%; }
.mail-preset-trigger {
  appearance: none; width: 100%; box-sizing: border-box;
  display: flex; align-items: center; gap: 10px;
  border: 1px solid #e4e7ec; border-radius: 10px; background: #fff;
  padding: 10px 12px; font: inherit; color: #1a1d26; cursor: pointer; text-align: left;
}
.mail-preset-trigger:hover { border-color: #d0d4dc; }
.mail-preset-picker.is-open .mail-preset-trigger {
  border-color: color-mix(in srgb, var(--accent) 45%, #d0d4dc);
}
.mail-preset-trigger-icon { display: flex; flex: none; }
.mail-preset-trigger-label { flex: 1; min-width: 0; }
.mail-preset-trigger .chevron {
  width: 10px; height: 10px; flex: none; border-right: 2px solid #8b8e98; border-bottom: 2px solid #8b8e98;
  transform: rotate(45deg); margin-top: -4px; transition: transform .15s ease;
}
.mail-preset-picker.is-open .mail-preset-trigger .chevron { transform: rotate(-135deg); margin-top: 2px; }
.mail-preset-menu {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 6px);
  background: #fff; border: 1px solid #e4e7ec; border-radius: 12px;
  box-shadow: 0 10px 28px rgba(26, 29, 38, .12); padding: 6px; display: flex; flex-direction: column; gap: 2px;
}
.mail-preset-menu.hidden { display: none; }
.mail-preset-option {
  appearance: none; border: 0; background: transparent; width: 100%;
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 8px; cursor: pointer; font: inherit; color: #1a1d26; text-align: left;
}
.mail-preset-option:hover { background: #f2f4f7; }
.mail-preset-option.is-selected {
  background: var(--accent); color: #fff;
}
.mail-preset-option-label { flex: 1; min-width: 0; }
.mail-preset-check { flex: none; font-weight: 700; }
.mail-provider-icon { display: inline-flex; width: 20px; height: 20px; flex: none; align-items: center; justify-content: center; }
.mail-provider-icon svg,
.mail-provider-icon img { display: block; width: 20px; height: 20px; object-fit: contain; }
.mail-provider-icon--outlook {
  width: 20px; height: 20px; border-radius: 5px; overflow: hidden;
}
.mail-provider-icon--outlook img {
  width: 20px; height: 20px; object-fit: cover;
}
.mail-oauth-btn { display: inline-flex; align-items: center; gap: 8px; }
.mail-oauth-btn .mail-provider-icon { width: 18px; height: 18px; }
.mail-oauth-btn .mail-provider-icon svg,
.mail-oauth-btn .mail-provider-icon img { width: 18px; height: 18px; }
.mail-oauth-btn .mail-provider-icon--outlook {
  width: 18px; height: 18px; border-radius: 4px;
}
.mail-oauth-btn .mail-provider-icon--outlook img {
  width: 18px; height: 18px;
}

.msg-caption { margin-top: 4px; }
.msg-caption:first-child { margin-top: 0; }

/* Polls in the calendar */
.calendar-mark.is-poll { background: var(--cal-poll, #8b6fe0); }
.calendar-poll-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.calendar-poll-item {
  display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left;
  padding: 9px 12px; border-radius: 10px; border: 1px solid rgba(139, 111, 224, .35);
  background: rgba(139, 111, 224, .08); color: inherit; font: inherit; cursor: pointer;
}
.calendar-poll-item:hover { background: rgba(139, 111, 224, .14); }
.calendar-poll-q { font-weight: 600; overflow-wrap: anywhere; }
.calendar-poll-meta { font-size: 12.5px; opacity: .72; }
.poll-card.is-scheduled { border-style: dashed; }

/* Image albums: mosaic of tiles that keep their orientation. */
.msg-album {
  position: relative; flex: 0 0 auto;
  width: 420px; max-width: 100%;
  border-radius: 12px; overflow: hidden;
  margin: 2px 0;
}
.msg.image-only .msg-album { margin: 0; }
.msg-album-tile { position: absolute; overflow: hidden; cursor: zoom-in; background: rgba(0, 0, 0, .06); }
.msg-album-img { display: block; width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-drag: none; }
/* Time pill sits on the collage, bottom-right (the bubble is the positioning parent). */
.msg.image-only .msg-bubble > .msg-foot {
  position: absolute; right: 8px; bottom: 8px; margin: 0; z-index: 2;
}

/* Dialogue: the message under discussion is a compact preview (expandable). */
.dialogue-root-slot.is-collapsed .msg.is-dialogue-root .msg-bubble {
  max-height: 100px; overflow: hidden;
}
.dialogue-root-slot.is-collapsed.has-overflow .msg.is-dialogue-root .msg-bubble {
  -webkit-mask-image: linear-gradient(#000 62%, transparent);
  mask-image: linear-gradient(#000 62%, transparent);
}
.dialogue-root-slot.is-collapsed .msg-image { max-width: 72px; max-height: 48px; }
.dialogue-root-slot.is-collapsed .msg-album { width: 84px; }
.dialogue-root-slot.is-collapsed .msg-body { font-size: calc(14px * var(--text-scale, 1)); }
.dialogue-root-slot.is-collapsed .msg-body { display: flex; flex-direction: column; }
.dialogue-root-slot.is-collapsed .msg-caption { order: -1; margin: 0 0 3px; }
.dialogue-root-toggle {
  display: block; margin: 4px 0 0 2px; padding: 2px 4px; border: 0; background: none;
  color: var(--accent, #2f6fd6); font: inherit; font-size: calc(12.5px * var(--text-scale, 1));
  font-weight: 600; cursor: pointer;
}
.dialogue-root-toggle[hidden] { display: none; }

/* Reactions inside the bubble: roomy soft pills, clear gap from text and bubble edge. */
.msg-bubble > .msg-reactions {
  margin: 10px 0 4px; max-width: 100%; flex: none; gap: 6px 8px;
}
.msg-bubble .msg-reaction {
  border-color: transparent; box-shadow: none;
  background: color-mix(in srgb, var(--accent, #2f6fd6) 12%, #fff);
  padding: 6px 14px 6px 10px; gap: 7px; min-height: 34px; box-sizing: border-box;
}
.msg-bubble .msg-reaction:hover { background: color-mix(in srgb, var(--accent, #2f6fd6) 20%, #fff); border-color: transparent; }
.msg-bubble .msg-reaction.is-mine { background: color-mix(in srgb, var(--accent, #2f6fd6) 30%, #fff); border-color: transparent; }
.msg-bubble .msg-reaction-count { color: var(--accent, #2f6fd6); font-weight: 600; font-size: calc(15px * var(--text-scale, 1)); }
.msg-bubble .msg-reaction-emoji { font-size: calc(20px * var(--text-scale, 1)); line-height: 1; }
.msg-bubble .msg-reaction-emoji img.icq-smiley { width: 22px; height: 22px; }
/* Chips kept in the meta row (media / dialogue root): use the full width, push the time pill down if needed. */
.msg-meta { flex-wrap: wrap; }
.msg-meta .msg-reactions { max-width: 100%; }

/* Profile settings: every field (inputs, password rows, language select) has the same height. */
#profile-form input[type="text"],
#profile-form input[type="password"],
#profile-form input:not([type]),
#profile-form select {
  height: 44px; min-height: 44px; box-sizing: border-box;
  padding-top: 0; padding-bottom: 0; line-height: 1.2;
}
#profile-form select {
  width: 100%; padding-left: 12px; padding-right: 12px;
  border: 1px solid #d0d4dc; border-radius: 4px; background-color: #fff;
  font: inherit; color: inherit;
}

/* ── Notes as sticky notes ── */
.notes-sticky-c0 { --st-bg: #fff3a8; --st-bd: #ecdc6f; }
.notes-sticky-c1 { --st-bg: #ffd9e2; --st-bd: #f3b3c3; }
.notes-sticky-c2 { --st-bg: #cfeedd; --st-bd: #a4d9bb; }
.notes-sticky-c3 { --st-bg: #d4e6ff; --st-bd: #a9c8f2; }
.notes-sticky-c4 { --st-bg: #e6dcff; --st-bd: #c7b6f0; }
.notes-sticky-c5 { --st-bg: #ffe2c2; --st-bd: #f1c291; }
.notes-item.notes-sticky {
  background: var(--st-bg); border: 1px solid var(--st-bd); border-radius: 6px 6px 14px 6px;
  box-shadow: 0 6px 14px rgba(40, 44, 60, .13), 0 1px 2px rgba(40, 44, 60, .1);
  min-height: 140px; max-height: 280px; overflow: hidden; padding: 14px 14px 12px; gap: 6px;
  transform: rotate(-.6deg); transition: transform .15s ease, box-shadow .15s ease;
}
.notes-grid > .notes-sticky:nth-child(even) { transform: rotate(.7deg); }
.notes-item.notes-sticky:hover {
  background: var(--st-bg); transform: translateY(-3px) rotate(0deg);
  box-shadow: 0 12px 22px rgba(40, 44, 60, .18);
}
.notes-sticky .notes-item-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notes-sticky .notes-item-preview { color: #4d5262; -webkit-line-clamp: 5; }
.notes-sticky .notes-item-meta { color: #7d7f6e; margin-top: auto; }
.notes-sticky-thumbs { display: flex; gap: 6px; align-items: center; }
.notes-sticky-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid rgba(0,0,0,.1); background: #fff; }
.notes-sticky-more { font-size: 12px; font-weight: 700; color: #5c6270; padding: 0 4px; }
.note-modal { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: 16px; }
.note-modal-backdrop { position: absolute; inset: 0; background: rgba(10, 14, 22, .45); }
.note-modal-card {
  position: relative; width: min(560px, 100%); max-height: min(86vh, 720px); overflow: auto;
  background: var(--st-bg, #fff3a8); border: 1px solid var(--st-bd, #ecdc6f); border-radius: 8px 8px 18px 8px;
  padding: 18px; box-shadow: 0 24px 60px rgba(10, 14, 22, .35);
}
.note-modal-card .notes-editor-title, .note-modal-card .notes-editor-body { background: rgba(255,255,255,.62); }
.note-modal-card .notes-editor-rich { min-height: 180px; }
.note-modal-card .notes-inline-img-wrap { display: inline-block; margin: 4px 6px 4px 0; vertical-align: top; }
.note-modal-card .notes-inline-img { max-height: 84px; max-width: 120px; object-fit: cover; cursor: zoom-in; }
.note-modal-card .notes-inline-img-remove { width: 22px; height: 22px; top: 3px; right: 3px; font-size: 15px; }

/* ── avatar editor modal ── */
.avatar-crop-modal { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; }
.avatar-crop-backdrop { position: absolute; inset: 0; background: rgba(10, 14, 22, .55); }
.avatar-crop-card {
  position: relative; width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px;
  background: #fff; border-radius: 18px; padding: 18px; box-shadow: 0 24px 60px rgba(10, 14, 22, .35);
}
.avatar-crop-title { font-weight: 800; font-size: 17px; color: #1a1d26; }
.avatar-crop-frame { border-radius: 22%; width: 200px; height: 200px; }

/* ── Favorites feature ── */
.fav-list { display: flex; flex-direction: column; gap: 8px; }
.fav-item {
  position: relative; background: #fff; border: 1px solid #e8eaef; border-radius: 12px;
  padding: 12px 40px 12px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 4px;
}
.fav-item:hover { background: #fafbfc; border-color: #d5d9e2; }
.fav-item-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.fav-item-who { font-weight: 700; color: #1a1d26; }
.fav-item-where, .fav-item-time { font-size: 12px; color: #8b8e98; }
.fav-item-time { margin-left: auto; }
.fav-item-text { color: #4d5262; font-size: 14px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.fav-item-star { position: absolute; top: 8px; right: 8px; appearance: none; border: 0; background: transparent; padding: 4px; border-radius: 8px; cursor: pointer; color: #b9bec9; display: grid; place-items: center; }
.fav-item-star.is-on { color: #f5b301; }

/* ── paper stickies with a pin, free-form board ── */
.notes-grid.notes-board { display: block; position: relative; width: 100%; min-height: 214px; padding: 0; }
.notes-item.notes-sticky {
  position: absolute; width: 200px; height: 200px; min-height: 0; max-height: none; box-sizing: border-box;
  padding: 34px 20px 14px 22px; gap: 5px; border: 0; border-radius: 2px;
  background: linear-gradient(135deg, #fff25e 0%, #fff7a0 45%, #fffbc2 100%);
  box-shadow: 7px 9px 9px rgba(20, 22, 30, .24), 1px 1px 0 rgba(0, 0, 0, .04);
  transform: rotate(var(--rot, 0deg)); transition: box-shadow .15s ease, transform .15s ease;
  cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; overflow: hidden;
}
.notes-grid > .notes-sticky:nth-child(even) { transform: rotate(var(--rot, 0deg)); }
.notes-item.notes-sticky:hover { background: linear-gradient(135deg, #fff25e 0%, #fff7a0 45%, #fffbc2 100%); transform: rotate(var(--rot, 0deg)) translateY(-2px); box-shadow: 9px 13px 14px rgba(20, 22, 30, .28); }
.notes-item.notes-sticky.is-dragging { cursor: grabbing; transition: none; transform: rotate(0deg) scale(1.03); box-shadow: 12px 18px 22px rgba(20, 22, 30, .32); }
.notes-sticky::before {
  content: ""; position: absolute; top: 9px; left: 50%; width: 22px; height: 22px; margin-left: -11px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #ff9a86 0%, #e8402a 42%, #b3200f 100%);
  box-shadow: 4px 6px 5px rgba(0, 0, 0, .3), inset -2px -2px 3px rgba(90, 10, 0, .35);
}
.notes-sticky .notes-item-title { font-size: 16px; }
.notes-sticky .notes-item-preview { -webkit-line-clamp: 4; }
.notes-sticky-thumb { width: 38px; height: 38px; }
.note-modal-card { background: linear-gradient(135deg, #fff25e 0%, #fff7a0 45%, #fffbc2 100%); border: 0; border-radius: 3px; padding-top: 30px; }
.note-modal-card::before {
  content: ""; position: absolute; top: 8px; left: 50%; width: 22px; height: 22px; margin-left: -11px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #ff9a86 0%, #e8402a 42%, #b3200f 100%);
  box-shadow: 4px 6px 5px rgba(0, 0, 0, .3), inset -2px -2px 3px rgba(90, 10, 0, .35);
}

/* touch: only the top strip (pin) drags a sticker; the rest still scrolls the page */
.notes-sticky-grip { position: absolute; top: 0; left: 0; right: 0; height: 40px; touch-action: none; z-index: 2; }

.fav-tabs { margin-bottom: 12px; }

/* ══ Paper stickies v3: cream sheet, torn top edge, coloured tape ══ */
.notes-item.notes-sticky {
  --paper: #faf3e8; --tape: #f4a6a6; --tape-rot: -35deg;
  background: none !important; border: 0; padding: 0; overflow: visible; box-shadow: none !important;
  filter: drop-shadow(6px 8px 5px rgba(70, 48, 20, .28));
}
.notes-item.notes-sticky:hover { background: none !important; box-shadow: none !important; filter: drop-shadow(8px 11px 8px rgba(70, 48, 20, .3)); }
.notes-item.notes-sticky.is-dragging { filter: drop-shadow(12px 16px 14px rgba(70, 48, 20, .34)); }
.notes-item.notes-sticky.is-open { opacity: 0; }
.notes-sticky::before { content: none !important; }
.notes-paper, .note-sheet-paper {
  background: var(--paper);
  -webkit-mask: radial-gradient(circle 4.5px at 50% 0, transparent 96%, #000) top left / 13px 9px repeat-x, linear-gradient(#000, #000) bottom left / 100% calc(100% - 4px) no-repeat;
  mask: radial-gradient(circle 4.5px at 50% 0, transparent 96%, #000) top left / 13px 9px repeat-x, linear-gradient(#000, #000) bottom left / 100% calc(100% - 4px) no-repeat;
}
.notes-paper {
  position: absolute; inset: 0; box-sizing: border-box; padding: 30px 18px 12px 22px;
  display: flex; flex-direction: column; gap: 5px; color: #3b3226; overflow: hidden; text-align: left;
}
.notes-sticky .notes-item-title { color: #3b3226; }
.notes-sticky .notes-item-preview { color: #5b4f40; }
.notes-sticky .notes-item-meta { color: #9a8c78; }
.notes-tape, .note-sheet-tape {
  position: absolute; top: -2px; left: -22px; width: 84px; height: 26px; z-index: 3; pointer-events: none;
  transform: rotate(var(--tape-rot, -35deg));
  background: linear-gradient(180deg, rgba(255,255,255,.35), rgba(255,255,255,0) 40%), color-mix(in srgb, var(--tape, #f4a6a6) 86%, transparent);
  clip-path: polygon(0 0, 100% 0, 96% 12%, 100% 25%, 96% 37%, 100% 50%, 96% 62%, 100% 75%, 96% 87%, 100% 100%, 0 100%, 4% 87%, 0 75%, 4% 62%, 0 50%, 4% 37%, 0 25%, 4% 12%);
}
.notes-sticky-grip { z-index: 4; }

/* the opened sheet */
.note-modal-backdrop { background: rgba(20, 16, 10, 0); transition: background .3s ease; }
.note-modal.is-shown .note-modal-backdrop { background: rgba(20, 16, 10, .45); }
.note-sheet {
  --paper: #faf3e8; --tape: #f4a6a6; --tape-rot: -35deg;
  position: relative; width: min(540px, 94vw); height: min(580px, 84vh); will-change: transform;
  filter: drop-shadow(10px 14px 14px rgba(0, 0, 0, .35));
}
.note-sheet-tape { top: -6px; left: -30px; width: 108px; height: 34px; }
.note-sheet-paper {
  position: absolute; inset: 0; box-sizing: border-box; padding: 40px 28px 18px; display: flex; flex-direction: column; overflow: hidden;
}
.note-sheet .notes-editor { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 10px; color: #3b3226; }
.note-sheet .notes-editor-title {
  background: transparent; border: 0; border-bottom: 1px dashed rgba(90, 70, 40, .35); border-radius: 0; padding: 4px 2px 8px;
  font-size: 20px; color: #3b3226; box-shadow: none;
}
.note-sheet .notes-editor-body { background: transparent; border: 0; border-radius: 0; padding: 4px 2px; flex: 1 1 auto; min-height: 0; color: #3b3226; box-shadow: none; }
.note-sheet .notes-editor-title:focus, .note-sheet .notes-editor-body:focus { outline: none; box-shadow: none; border-color: rgba(90, 70, 40, .5); }
.note-sheet .notes-editor-rich { min-height: 0; overflow: auto; }
.note-sheet .notes-editor-rich.is-empty:before { color: #a89a85; }
.note-sheet .notes-inline-img-wrap { display: inline-block; margin: 4px 6px 4px 0; vertical-align: top; }
.note-sheet .notes-inline-img { max-height: 84px; max-width: 120px; object-fit: cover; cursor: zoom-in; }
.note-sheet .notes-inline-img-remove { width: 22px; height: 22px; top: 3px; right: 3px; font-size: 15px; }
.note-sheet .notes-editor-tools { justify-content: flex-start; }
.note-sheet .notes-editor-tools .danger { margin-left: auto; }
.note-sheet-colors { display: flex; flex-wrap: wrap; gap: 8px 18px; padding-top: 6px; border-top: 1px dashed rgba(90, 70, 40, .25); }
.note-sheet-colorgroup { display: flex; align-items: center; gap: 6px; }
.note-sheet-colorlabel { font-size: 12px; font-weight: 700; color: #8a7b66; margin-right: 2px; }
.note-swatch {
  appearance: none; width: 20px; height: 20px; border-radius: 50%; padding: 0; border: 2px solid rgba(255,255,255,.9);
  box-shadow: 0 0 0 1px rgba(60, 40, 10, .28); cursor: pointer; display: grid; place-items: center; font: inherit; font-size: 12px; line-height: 1; color: #5b4f40; background: #fff;
}
.note-swatch.is-on { box-shadow: 0 0 0 2px #3b3226; }
@media (max-width: 560px) { .note-sheet-paper { padding: 36px 18px 14px; } }

/* Notes: card wide enough for five stickers in a row (5 × 200px + 4 gaps) */
.feature-screen.is-notes .feature-card { width: min(var(--notes-w, 720px), 100%); }

/* favorite mark beside a message: peer → left of the bubble, own → right */
.msg-bubble.is-fav { position: relative; margin-left: 20px; }
.msg.mine .msg-bubble.is-fav { margin-left: 0; margin-right: 20px; }
.msg-fav-star { position: absolute; top: 50%; left: -19px; width: 16px; height: 16px; margin-top: -8px; color: #f5b301; pointer-events: none; display: grid; place-items: center; }
.msg-fav-star svg { width: 16px; height: 16px; display: block; }
.msg.mine .msg-fav-star { left: auto; right: -19px; }

.msg-submenu { z-index: 90; min-width: 180px; }
.msg-menu-item.has-submenu .msg-menu-trailing { font-size: 20px; line-height: 1; color: #8b8e98; }

/* —— Orbitcast incoming video call: static first, then the caller tunes in —— */
.call-incoming {
  position: fixed; top: 84px; right: 16px; z-index: 80; /* above an open meeting */
  width: 280px; max-width: calc(100vw - 24px); box-sizing: border-box; padding: 12px;
  border-radius: 16px; border: var(--glass-border); background: var(--glass-panel-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur)); backdrop-filter: blur(var(--glass-blur));
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.28);
  animation: call-in 0.28s ease-out;
}
.call-incoming.hidden { display: none !important; }
@keyframes call-in {
  from { opacity: 0; transform: translateY(-10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.call-screen {
  position: relative; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden;
  background: radial-gradient(circle at 50% 45%, #22325a 0%, #0d1424 75%);
  display: flex; align-items: center; justify-content: center;
}
.call-incoming .call-avatar.avatar {
  width: 96px; height: 96px; min-width: 96px; min-height: 96px; max-width: 96px; max-height: 96px;
  flex: none; align-self: center; opacity: 0;
}
.call-noise {
  position: absolute; inset: 0; width: 100%; height: 100%;
  image-rendering: pixelated; transition: opacity 0.45s ease-out;
}
.call-scanlines {
  position: absolute; inset: 0; pointer-events: none; opacity: 0.55;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px);
}
.call-incoming.is-tuned .call-noise { opacity: 0; }
.call-incoming.is-tuned .call-scanlines { opacity: 0.25; transition: opacity 0.6s; }
.call-incoming.is-tuned .call-avatar.avatar {
  animation: call-tune 0.75s ease-out forwards, call-ring 1.8s 0.75s ease-out infinite;
}
/* The picture locks in: blurred, high-contrast, jittering, then clean. */
@keyframes call-tune {
  0% { opacity: 0; filter: blur(8px) contrast(2.4) grayscale(1); transform: translateX(-7px) scaleY(1.06); }
  18% { opacity: 0.85; transform: translateX(6px) skewX(-8deg); }
  32% { opacity: 0.6; transform: translateX(-4px) skewX(6deg); filter: blur(4px) contrast(1.8) grayscale(0.7); }
  50% { opacity: 1; transform: translateX(2px); filter: blur(1.5px) contrast(1.3) grayscale(0.3); }
  100% { opacity: 1; transform: none; filter: none; }
}
@keyframes call-ring {
  0% { box-shadow: 0 0 0 0 rgba(121, 57, 242, 0.6); }
  100% { box-shadow: 0 0 0 20px rgba(121, 57, 242, 0); }
}
.call-info {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  margin: 10px 0 12px; text-align: center; min-width: 0;
}
.call-info strong {
  max-width: 100%; font-size: 15px; color: #1b1d21;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.call-info span { font-size: 13px; color: #6b7080; }
.call-actions { display: flex; justify-content: center; gap: 32px; }
.call-btn {
  width: 52px; height: 52px; border: 0; border-radius: 50%; cursor: pointer; color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: filter 0.15s, transform 0.15s;
}
.call-btn:hover { filter: brightness(1.08); transform: scale(1.05); }
.call-btn-decline { background: #e5484d; }
.call-btn-accept { background: #30a46c; }
@media (max-width: 700px) {
  .call-incoming { top: calc(env(safe-area-inset-top, 0px) + 64px); left: 12px; right: 12px; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .call-incoming, .call-incoming.is-tuned .call-avatar.avatar { animation: none; opacity: 1; }
  .call-incoming .call-avatar.avatar { opacity: 1; }
}

/* —— Orbitcast meeting over the chat (same-origin iframe) —— */
/* Meeting window over the dimmed app; minimized → small floating window; full screen. */
.cast-overlay {
  position: fixed; inset: 0; z-index: 70;
  display: flex; align-items: center; justify-content: center;
  background: rgba(14, 18, 32, 0.42);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: cast-overlay-in 0.22s ease-out;
}
.cast-window {
  position: relative; display: flex; flex-direction: column;
  width: min(1180px, 92vw); height: min(780px, 88vh);
  border-radius: 18px; overflow: hidden; background: #0e1626;
  box-shadow: 0 24px 70px rgba(5, 8, 20, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.cast-window-head {
  flex: none; display: flex; align-items: center; gap: 4px; height: 40px; padding: 0 8px 0 16px;
  background: #0b1220; color: #c9d1e4; border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  user-select: none;
}
.cast-window-dot { display: none; width: 8px; height: 8px; border-radius: 50%; background: #3ecf72; flex: none; margin-right: 4px; box-shadow: 0 0 0 3px rgba(62, 207, 114, 0.22); }
.cast-window-title {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13px; font-weight: 600; color: #9aa6c2;
}
.cast-window-time { font-size: 12px; color: #9aa6c2; font-variant-numeric: tabular-nums; flex: none; margin-right: 4px; }
.cast-win-btn {
  appearance: none; border: 0; background: transparent; color: #c9d1e4;
  width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; flex: none;
}
.cast-win-btn:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.cast-win-restore, .cast-win-leave, .cast-resize { display: none; }
.cast-frame { display: block; flex: 1; min-height: 0; width: 100%; border: 0; }

/* Full screen (browser full screen, or the CSS fallback). */
.cast-window:fullscreen { width: 100vw; height: 100vh; border-radius: 0; }
.cast-overlay.is-full .cast-window { width: 100vw; height: 100vh; border-radius: 0; }

/* Minimized: a floating window over the usable app — drag by the head, resize by the corner. */
.cast-overlay.is-mini {
  background: none; -webkit-backdrop-filter: none; backdrop-filter: none;
  pointer-events: none; animation: none;
}
.cast-overlay.is-mini .cast-window {
  position: fixed; pointer-events: auto; border-radius: 14px;
  min-width: 0; min-height: 0;
  box-shadow: 0 18px 50px rgba(5, 8, 20, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.08);
  animation: cast-float-in 0.18s ease-out;
}
.cast-overlay.is-mini .cast-window-head { height: 34px; padding: 0 4px 0 12px; cursor: grab; }
.cast-overlay.is-mini .cast-window.is-moving .cast-window-head { cursor: grabbing; }
.cast-overlay.is-mini .cast-window-dot { display: inline-block; }
.cast-overlay.is-mini .cast-win-btn { width: 28px; height: 28px; }
.cast-overlay.is-mini .cast-win-min, .cast-overlay.is-mini .cast-win-full { display: none; }
.cast-overlay.is-mini .cast-win-restore { display: grid; }
.cast-overlay.is-mini .cast-win-leave { display: grid; background: #e5484d; color: #fff; margin-left: 2px; }
.cast-overlay.is-mini .cast-win-leave:hover { background: #d13a3f; }
.cast-overlay.is-mini .cast-resize {
  display: block; position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 50%, rgba(255, 255, 255, 0.35) 50%, rgba(255, 255, 255, 0.35) 58%, transparent 58%, transparent 70%, rgba(255, 255, 255, 0.35) 70%, rgba(255, 255, 255, 0.35) 78%, transparent 78%);
  touch-action: none;
}
.cast-window.is-moving .cast-frame { pointer-events: none; }
@keyframes cast-float-in { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
@media (max-width: 720px) {
  .cast-overlay:not(.is-mini) .cast-window { width: 100vw; height: 100dvh; border-radius: 0; }
}
html.cast-open, html.cast-open body { overflow: hidden; }
@keyframes cast-overlay-in {
  from { opacity: 0; transform: scale(0.985); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cast-overlay { animation: none; }
}

/* —— Video call record in chat: icon, then the sentence —— */
.call-record { display: flex; align-items: center; gap: 10px; min-width: 0; }
.call-record-icon { flex: none; display: flex; }
.call-record-icon svg { display: block; width: 40px; height: 28px; }
.call-record-text { min-width: 0; overflow-wrap: anywhere; line-height: 1.35; }

/* —— Icon action rows in profile / channel cards —— */
.card-rail-tools.card-actions { justify-content: center; gap: 28px; }
.card-rail-tools.card-actions.hidden { display: none !important; }
.card-rail-tools.card-actions .rail-btn { flex: 0 0 56px; width: 56px; }
.card-rail-tools.card-actions .rail-btn.hidden { display: none !important; }

/* —— Conference record in a channel —— */
.conf-record { display: flex; align-items: center; gap: 12px; min-width: 0; flex-wrap: wrap; }
.conf-record-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 180px; }
.conf-record-info strong { overflow-wrap: anywhere; }
.conf-record-sub { font-size: 13px; color: #6b7080; overflow-wrap: anywhere; }
.msg-body .btn.conf-record-join {
  flex: none; padding: 6px 14px; border-radius: 8px; border: 0;
  background: var(--accent, #7939f2); color: #fff; font-weight: 600; cursor: pointer;
}
.msg-body .btn.conf-record-join:hover { filter: brightness(1.08); }
.conf-record-join[hidden] { display: none; }

/* —— Conference dialog —— */
.conf-dialog { width: min(520px, 100%); }
.conf-section {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  margin: 16px 0 6px; font-weight: 600; font-size: 14px; color: #1b1d21;
}
.conf-count { font-weight: 400; font-size: 13px; color: #6b7080; }
.dialog-body .conf-search {
  width: 100%; box-sizing: border-box; height: 38px; padding: 0 12px; margin-bottom: 6px;
  border: 1px solid #d0d4dc; border-radius: 8px; font: inherit; font-size: 14px;
}
.conf-people {
  max-height: 240px; overflow-y: auto; border: 1px solid #e4e7ec; border-radius: 10px; padding: 4px;
}
/* .dialog-body label / input are block and full-width; a person row is neither. */
.dialog-body label.conf-person {
  display: flex; align-items: center; gap: 10px; margin: 0; padding: 6px 8px; border-radius: 8px;
  cursor: pointer; font-size: 14px; font-weight: 400;
}
.conf-person:hover { background: #f3f5f8; }
.dialog-body .conf-person input { flex: none; margin: 0; width: 16px; height: 16px; accent-color: var(--accent, #7939f2); }
.conf-person .avatar { width: 28px; height: 28px; min-width: 28px; min-height: 28px; max-width: 28px; max-height: 28px; flex: 0 0 28px; align-self: center; }
.conf-person-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.conf-person-tag { flex: none; font-size: 12px; color: #6b7080; }
.conf-empty { padding: 12px; text-align: center; color: #6b7080; font-size: 14px; }
.conf-segment { display: flex; gap: 4px; padding: 4px; border-radius: 10px; background: #f0f2f6; }
.conf-segment button {
  flex: 1; height: 34px; border: 0; border-radius: 8px; background: transparent;
  font: inherit; font-size: 14px; font-weight: 600; color: #5b6070; cursor: pointer;
}
.conf-segment button.is-active { background: #fff; color: #1b1d21; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12); }
.conf-schedule { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.conf-schedule[hidden] { display: none; }
.conf-remind {
  height: 38px; padding: 0 10px; border: 1px solid #d0d4dc; border-radius: 8px; font: inherit; font-size: 14px; background: #fff;
}
.conf-note { font-size: 12px; color: #6b7080; line-height: 1.4; }
.conf-dialog .form-error:not(:empty) { margin-top: 10px; }
.conf-dialog .btn.wide { margin-top: 14px; }

/* Channel tools panel: 8 tools incl. "Создать конференцию" — icons keep their size;
   buttons share the width but never go below 36px (scrolls on very narrow cards). */
.channel-rail-tools, #card-rail-tools { overflow-x: auto; scrollbar-width: none; }
.channel-rail-tools::-webkit-scrollbar, #card-rail-tools::-webkit-scrollbar { display: none; }
.channel-rail-tools .rail-btn, #card-rail-tools .rail-btn { flex: 1 0 36px; min-width: 36px; width: auto; }
.channel-rail-tools .rail-btn svg, #card-rail-tools .rail-btn svg { flex: none; width: 22px; height: 22px; }
#card-rail-tools .rail-btn.hidden { display: none !important; }

/* Conference dialog: invite link + approval switch. */
.conf-link { display: flex; gap: 8px; align-items: center; }
.dialog-body .conf-link-input {
  flex: 1; min-width: 0; width: auto; height: 38px; margin: 0; padding: 0 12px; box-sizing: border-box;
  border: 1px solid #d0d4dc; border-radius: 8px; font: inherit; font-size: 14px; color: #1b1d21; background: #f7f8fa;
}
.conf-dialog .btn.conf-link-copy { flex: none; height: 38px; margin: 0; padding: 0 14px; }
.conf-link + .conf-note { margin-top: 6px; }
.dialog-body label.conf-option {
  display: flex; align-items: flex-start; gap: 10px; margin: 14px 0 0; cursor: pointer;
  font-size: 14px; font-weight: 600; color: #1b1d21;
}
.dialog-body .conf-option input { flex: none; margin: 2px 0 0; width: 16px; height: 16px; accent-color: var(--accent, #7939f2); }
.conf-option-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.conf-option-text .conf-note { font-weight: 400; }

/* Red call icon in previews (calendar, notifications, reply/pinned quotes). */
.call-icon-inline { display: inline-flex; vertical-align: -0.18em; margin-right: 0.35em; }
.call-icon-inline svg { width: auto; height: 1.05em; }

/* Conference dialog: meeting password. */
.dialog-body label.conf-password-label { display: flex; margin: 14px 0 6px; font-weight: 600; font-size: 14px; }
.dialog-body .conf-password {
  width: 100%; box-sizing: border-box; height: 38px; margin: 0 0 4px; padding: 0 12px;
  border: 1px solid #d0d4dc; border-radius: 8px; font: inherit; font-size: 14px;
}

/* Profile card tool bar: five icons, the rest behind the chevron (second row when open). */
#card-rail-tools.has-more .rail-btn { flex: 0 0 calc((100% - 5 * 4px) / 6); min-width: 0; }
/* Collapsed: hide the overflow. Opened: they keep the normal button display (centred icon). */
#card-rail-tools:not(.is-expanded) .rail-btn.is-overflow { display: none !important; }
#card-rail-tools.is-expanded { flex-wrap: wrap; height: auto; row-gap: 4px; }
#card-rail-tools.has-more { justify-content: flex-start; }
#card-rail-tools .card-tools-more svg { transition: transform 0.15s; }
#card-rail-tools.is-expanded .card-tools-more svg { transform: rotate(180deg); }

/* Settings → Appearance → View: tool order. */
.card-tools-order { list-style: none; margin: 10px 0 12px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.card-tools-order-row {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; background: #f6f7fa;
}
.card-tools-order-icon { display: flex; color: #3f4350; }
.card-tools-order-icon svg { width: 20px; height: 20px; }
.card-tools-order-name { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-tools-order-drag {
  appearance: none; border: 0; background: transparent; color: #9aa0ab;
  width: 28px; height: 32px; border-radius: 8px; padding: 0; cursor: grab;
  display: grid; place-items: center; flex: none; touch-action: none; user-select: none;
}
.card-tools-order-drag:active { cursor: grabbing; }
.card-tools-order-drag:focus-visible { outline: 2px solid var(--accent, #1c58d9); }
.card-tools-order-drag svg { width: 16px; height: 16px; display: block; pointer-events: none; }
.card-tools-order-row { transition: box-shadow .15s ease; }
.card-tools-order-row.is-dragging {
  position: fixed; z-index: 80; margin: 0; pointer-events: none; background: #fff;
  box-shadow: 0 10px 28px rgba(26, 29, 38, 0.18);
  outline: 1px solid color-mix(in srgb, var(--accent, #1c58d9) 28%, #e4e7ec);
}
.card-tools-order-spacer {
  border-radius: 10px; box-sizing: border-box;
  border: 1.5px dashed color-mix(in srgb, var(--accent, #1c58d9) 45%, #d0d4dc);
  background: color-mix(in srgb, var(--accent, #1c58d9) 6%, #fff);
}
.card-tools-order-sep {
  margin: 6px 0 2px; font-size: 12px; color: #6b7080; display: flex; align-items: center; gap: 8px;
}
.card-tools-order-sep::before, .card-tools-order-sep::after { content: ""; flex: 1; border-top: 1px dashed #c9cdd6; }

/* Small meeting window: the head overlays the video and fades with the page's panels. */
.cast-overlay.is-mini .cast-window-head {
  position: absolute; left: 0; right: 0; top: 0; z-index: 2;
  background: linear-gradient(rgba(11, 18, 32, 0.92), rgba(11, 18, 32, 0.6));
  border-bottom: 0; transition: opacity 0.25s ease;
}
.cast-overlay.is-mini .cast-window.is-idle .cast-window-head,
.cast-overlay.is-mini .cast-window.is-idle .cast-resize { opacity: 0; }
.cast-overlay.is-mini .cast-window.is-idle .cast-window-head:hover { opacity: 1; }
.cast-overlay.is-mini .cast-window.is-idle:hover .cast-resize { opacity: 1; }
