:root {
  --app-height: 100vh;
  --app-top: 0px;
  --keyboard-inset: 0px;
  --bg-top: #edf6ff;
  --bg-mid: #dbe9f7;
  --bg-bottom: #d3e0ef;
  --glass: rgba(255, 255, 255, 0.6);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --line: rgba(120, 157, 193, 0.28);
  --text: #203348;
  --muted: #68829c;
  --blue: #2f94f3;
  --blue-strong: #1875cf;
  --accent-mint: #2fcf9f;
  --danger: #cc4a4a;
  --shadow: 0 22px 60px rgba(46, 82, 115, 0.2);
}

body[data-theme="dark"] {
  --bg-top: #0a121b;
  --bg-mid: #0f1d2a;
  --bg-bottom: #122536;
  --glass: rgba(21, 35, 49, 0.62);
  --glass-strong: rgba(24, 39, 55, 0.78);
  --line: rgba(108, 150, 188, 0.28);
  --text: #dbe9f6;
  --muted: #87a4bf;
  --shadow: 0 22px 60px rgba(3, 9, 16, 0.45);
}

body[data-theme="dark"] .auth-hero {
  background:
    radial-gradient(circle at top right, rgba(61, 130, 184, 0.22), transparent 30%),
    linear-gradient(180deg, rgba(22, 38, 53, 0.84), rgba(18, 30, 43, 0.8));
}

body[data-theme="dark"] .auth-feature-card,
body[data-theme="dark"] .auth-card {
  background: rgba(22, 38, 53, 0.82);
}

* {
  box-sizing: border-box;
}

*::selection {
  background: rgba(47, 148, 243, 0.24);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Manrope, sans-serif;
  background: linear-gradient(155deg, var(--bg-top), var(--bg-mid) 55%, var(--bg-bottom));
  overflow: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

html,
body {
  overscroll-behavior: none;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

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

.ambient {
  position: fixed;
  border-radius: 999px;
  filter: blur(70px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.65;
  animation: float 12s ease-in-out infinite;
}

.ambient-a {
  width: 360px;
  height: 360px;
  left: -90px;
  top: -80px;
  background: #8bd0ff;
}

.ambient-b {
  width: 420px;
  height: 420px;
  right: -120px;
  bottom: -120px;
  background: #9ed7be;
  animation-delay: -4s;
}

body[data-theme="dark"] .ambient-a {
  background: #1f4f79;
}

body[data-theme="dark"] .ambient-b {
  background: #2d5b4f;
}

.noise-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.34) 0.4px, transparent 0.6px);
  background-size: 4px 4px;
  opacity: 0.2;
}

.root {
  position: relative;
  min-height: 100vh;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(35, 54, 74, 0.45);
  backdrop-filter: blur(2px);
  z-index: 28;
}

.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-shell {
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
  align-items: stretch;
}

.auth-hero {
  padding: 30px;
  display: grid;
  gap: 14px;
  align-content: start;
  min-height: 220px;
  background:
    radial-gradient(circle at top right, rgba(84, 179, 255, 0.18), transparent 30%),
    linear-gradient(180deg, rgba(255,255,255,0.78), rgba(245,250,255,0.7));
}

.auth-brand-badge {
  width: 92px;
  height: 92px;
  border-radius: 0;
  display: grid;
  place-items: center;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.auth-brand-badge img {
  width: 112%;
  height: 112%;
  display: block;
  object-fit: contain;
}

.auth-card {
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255,255,255,0.86), rgba(246,250,255,0.78));
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  padding: 28px;
  display: grid;
  gap: 16px;
  animation: reveal 0.45s ease;
}

.auth-card-head {
  display: grid;
  gap: 4px;
}

.auth-card-head strong {
  font-size: 24px;
}

.auth-form-grid {
  gap: 12px;
}

.auth-card p {
  color: var(--muted);
}

.segmented {
  display: flex;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.38);
}

.segmented.compact {
  margin-top: 2px;
}

.seg-btn {
  flex: 1;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  padding: 8px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.seg-btn.active {
  background: rgba(255, 255, 255, 0.85);
  color: var(--text);
  box-shadow: 0 4px 12px rgba(54, 86, 117, 0.12);
}

.stack {
  display: grid;
  gap: 10px;
}

label {
  display: grid;
  gap: 5px;
}

label span {
  color: var(--muted);
  font-size: 13px;
}

input,
textarea,
select {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  padding: 10px 11px;
  color: var(--text);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(62, 149, 228, 0.6);
  box-shadow: 0 0 0 3px rgba(61, 148, 228, 0.12);
}

button {
  cursor: pointer;
}

.primary,
.ghost,
.icon-btn {
  border-radius: 12px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}

.primary {
  border: none;
  padding: 10px 14px;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(180deg, #45a8ff, var(--blue));
  box-shadow: 0 10px 18px rgba(47, 148, 243, 0.28);
}

.primary:hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, #53b0ff, var(--blue-strong));
}

.ghost {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.66);
  color: var(--text);
  padding: 9px 11px;
}

.ghost:hover,
.icon-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(66, 102, 137, 0.14);
}

.icon-btn {
  width: 37px;
  height: 37px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: #5f7892;
  display: inline-grid;
  place-items: center;
}

.ui-icon {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}

.ui-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.ui-icon.sm {
  width: 16px;
  height: 16px;
}

.ui-icon.xs {
  width: 14px;
  height: 14px;
}

.inline-icon {
  vertical-align: -2px;
  margin-right: 4px;
}

.error {
  min-height: 18px;
  color: var(--danger);
  font-size: 13px;
}

.chat-view {
  min-height: 100vh;
  padding: 14px;
}

.app-shell {
  max-width: 1500px;
  margin: 0 auto;
  height: calc(100vh - 28px);
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 12px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), var(--glass-strong));
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  pointer-events: none;
}

.toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 24px));
}

.toast {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 40px rgba(31, 62, 92, 0.22);
  padding: 12px 14px;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.18s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast strong {
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
}

.toast p {
  color: var(--muted);
  font-size: 12px;
}

.toast.success {
  border-color: rgba(80, 176, 135, 0.34);
}

.toast.error {
  border-color: rgba(212, 122, 122, 0.34);
}

.update-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 12px 0;
  padding: 10px 12px;
  border: 1px solid rgba(93, 165, 228, 0.32);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(235, 247, 255, 0.94), rgba(225, 241, 255, 0.86));
  animation: reveal-soft 0.22s ease;
}

.chat-head-actions .ghost.hidden {
  display: none;
}

.chat-head-actions .ghost {
  min-height: 36px;
}

.selection-icon-btn {
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 12px;
  display: inline-grid;
  place-items: center;
}

.selection-icon-btn.active {
  border-color: rgba(74, 159, 230, 0.44);
  background: linear-gradient(180deg, rgba(230, 244, 255, 0.94), rgba(218, 238, 255, 0.88));
}

.chat-head.selection-mode .chat-head-main {
  gap: 10px;
}

.update-banner strong {
  display: block;
  font-size: 14px;
}

.empty-panel,
.empty-chat-state {
  border: 1px dashed rgba(126, 166, 199, 0.34);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.44);
  padding: 18px;
  text-align: center;
}

.empty-panel {
  list-style: none;
}

.empty-panel strong,
.empty-chat-state strong {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
}

.left-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  min-height: 0;
  animation: reveal 0.35s ease;
  overflow: hidden;
}

.left-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.me-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.me-mini h2 {
  font: 700 15px "Nunito Sans", sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.me-mini p {
  color: var(--muted);
  font-size: 12px;
}

.search-wrap input {
  width: 100%;
}

.room-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.room-tools {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(114, 158, 195, 0.22);
  border-radius: 18px;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
}

.room-tools-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.room-tools-head strong {
  display: block;
  font-size: 14px;
}

.room-tool-btn {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  padding: 0;
  flex: 0 0 auto;
}

.room-tool-btn .btn-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  margin-left: 0;
  padding: 0 4px;
  font-size: 9px;
}

.chat-list .room-card-badges {
  display: none !important;
}

.chat-list .chat-more-btn {
  display: none !important;
}

.room-lock-icon {
  color: var(--muted);
  vertical-align: -1px;
}

.list-filters {
  display: flex;
  gap: 6px;
  align-items: center;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.list-filters::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.56);
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
}

.filter-chip.active {
  background: linear-gradient(180deg, rgba(77, 165, 243, 0.2), rgba(46, 147, 235, 0.24));
  border-color: rgba(62, 150, 229, 0.55);
  color: #265a82;
  box-shadow: 0 8px 14px rgba(47, 148, 243, 0.18);
}

.btn-badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-left: 6px;
  border-radius: 999px;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(180deg, #45a8ff, #2f94f3);
}

.chat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: block;
  flex: 1 1 auto;
  overflow: auto;
  min-height: 0;
  height: 100%;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.chat-list > * + * {
  margin-top: 3px;
}

.chat-item {
  border: 1px solid rgba(122, 166, 204, 0.12);
  border-radius: 14px;
  padding: 8px 9px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  position: relative;
  overflow: hidden;
  touch-action: pan-y;
  background: rgba(255, 255, 255, 0.16);
}

.chat-item::before {
  content: attr(data-swipe-label);
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: #2a648f;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.chat-item.swiping::before {
  opacity: 0.8;
}

.chat-item.swipe-left::before {
  left: 10px;
}

.chat-item.swipe-right::before {
  right: 10px;
}

.chat-item .avatar {
  width: 38px;
  height: 38px;
  font-size: 12px;
}

.chat-item:hover {
  background: rgba(255, 255, 255, 0.66);
  border-color: rgba(118, 171, 217, 0.28);
}

.chat-item.active {
  border-color: rgba(98, 164, 223, 0.42);
  background: linear-gradient(180deg, rgba(235, 247, 255, 0.98), rgba(226, 241, 255, 0.9));
  box-shadow: inset 2px 0 0 #4aa5f2, 0 8px 14px rgba(68, 126, 176, 0.06);
}

.chat-item-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.chat-item-main strong,
.chat-item-main p {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item-main strong {
  font-size: 13px;
  font-weight: 700;
}

.room-card-headline {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
}

.dm-headline {
  justify-content: flex-start;
}

.room-headline {
  justify-content: flex-start;
}

.name-with-presence {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.dm-presence-dot {
  flex: 0 0 auto;
}

.room-card-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 3px 0 4px;
}

.dm-entry .dm-hidden-ui {
  display: none !important;
}

.chat-item-main p {
  font-size: 11px;
  color: var(--muted);
}

.chat-list-preview {
  line-height: 1.25;
  padding-right: 4px;
}

.chat-list-time {
  flex: 0 0 auto;
  font-size: 10px;
  color: #8097ad;
}

.chat-item-tail {
  display: grid;
  gap: 5px;
  justify-items: end;
  min-width: 52px;
  align-self: stretch;
  align-content: center;
}

.chat-item-tail .chat-unread {
  order: -1;
}

.chat-item-tail.has-unread {
  align-content: space-between;
}

.chat-mini-flag {
  min-width: 22px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  border: 1px solid rgba(124, 167, 203, 0.24);
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
  display: inline-grid;
  place-items: center;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.chat-mini-flag .ui-icon {
  width: 12px;
  height: 12px;
}

.chat-item-badge {
  font-size: 10px;
  line-height: 1;
  padding: 4px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.66);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.chat-item-badge.lock {
  border-color: rgba(208, 147, 88, 0.35);
  color: #8a5f2b;
  background: rgba(255, 236, 214, 0.7);
}

.chat-item-badge.public {
  border-color: rgba(105, 167, 223, 0.38);
  color: #3b668d;
  background: rgba(229, 244, 255, 0.72);
}

.chat-item-badge.dm {
  border-color: rgba(116, 151, 195, 0.34);
  color: #4b6c8b;
  background: rgba(232, 241, 250, 0.76);
}

.chat-item-badge.online {
  border-color: rgba(77, 180, 130, 0.34);
  color: #2f7b58;
  background: rgba(227, 247, 237, 0.8);
}

.chat-item-badge.invitation {
  border-color: rgba(60, 172, 130, 0.38);
  color: #2c7a5c;
  background: rgba(226, 248, 239, 0.78);
}

.chat-item-badge.manage {
  border-color: rgba(117, 149, 205, 0.34);
  color: #446991;
  background: rgba(229, 239, 250, 0.78);
}

.chat-item-arrow {
  font-size: 11px;
  font-weight: 700;
  color: #7f98b1;
  line-height: 1;
  display: inline-grid;
  place-items: center;
  opacity: 0.7;
}

.chat-more-btn {
  border: 1px solid rgba(130, 170, 206, 0.32);
  background: rgba(255, 255, 255, 0.72);
  color: #6f8ba6;
  border-radius: 8px;
  width: 22px;
  height: 20px;
  padding: 0;
  line-height: 1;
  font-size: 14px;
  display: inline-grid;
  place-items: center;
}

.chat-more-btn:hover {
  background: rgba(242, 250, 255, 0.94);
}

.chat-unread {
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(180deg, #45a8ff, #2f94f3);
  box-shadow: 0 8px 14px rgba(47, 148, 243, 0.22);
  animation: unread-pop 2.2s ease-in-out infinite;
}

.center-panel {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  animation: reveal 0.4s ease;
  position: relative;
}

.chat-head {
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.56), rgba(255, 255, 255, 0.24));
}

.chat-head.selection-mode {
  border-bottom-color: rgba(76, 164, 236, 0.38);
  background: linear-gradient(180deg, rgba(226, 243, 255, 0.96), rgba(212, 234, 252, 0.9));
  box-shadow: inset 0 -1px 0 rgba(95, 171, 235, 0.18), 0 12px 26px rgba(61, 122, 178, 0.1);
  animation: selection-head-in 0.18s ease;
}

.chat-head.selection-mode .chat-head-actions {
  gap: 6px;
}

.chat-head.selection-mode .chat-head-actions .ghost {
  min-height: 34px;
  border-radius: 999px;
  padding: 7px 11px;
}

.chat-head-main {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.chat-head-main.clickable {
  cursor: pointer;
}

.chat-head-main.clickable:hover {
  opacity: 0.96;
}

.chat-head-main .avatar {
  width: 42px;
  height: 42px;
  font-size: 13px;
  box-shadow: 0 8px 16px rgba(51, 98, 139, 0.1);
}

.chat-head-main h3 {
  font: 700 16px "Nunito Sans", sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-head-main p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.chat-head-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chat-head-actions .ghost {
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
}

.chat-actions-trigger {
  min-width: 112px;
  text-align: center;
  font-weight: 600;
  box-shadow: 0 10px 18px rgba(61, 110, 154, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.messages {
  overflow: auto;
  min-height: 0;
  padding: 14px;
  display: grid;
  align-content: start;
  justify-items: start;
  gap: 9px;
  background: linear-gradient(180deg, rgba(248, 252, 255, 0.52), rgba(243, 248, 253, 0.42));
  overscroll-behavior: contain;
}

.messages.drop-active {
  outline: 2px dashed rgba(71, 158, 232, 0.6);
  outline-offset: -8px;
}

.jump-bottom {
  position: absolute;
  right: 14px;
  bottom: 84px;
  z-index: 5;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 700;
  border-color: rgba(102, 160, 210, 0.45);
  box-shadow: 0 10px 18px rgba(43, 104, 155, 0.24);
}

.date-separator {
  justify-self: center;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(125, 167, 203, 0.34);
  background: rgba(234, 246, 255, 0.82);
  color: #577390;
  font-size: 11px;
  font-weight: 700;
}

.sticky-day {
  position: absolute;
  top: 62px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  pointer-events: none;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(125, 167, 203, 0.38);
  background: rgba(236, 248, 255, 0.9);
  color: #4f6f8e;
  font-size: 11px;
  font-weight: 700;
  backdrop-filter: blur(6px);
}

.date-separator.unread-separator {
  background: rgba(214, 238, 255, 0.92);
  border-color: rgba(84, 154, 213, 0.5);
  color: #2f6794;
}

.pinned-banner {
  border: 1px solid rgba(120, 171, 214, 0.45);
  background: linear-gradient(180deg, rgba(241, 250, 255, 0.96), rgba(231, 244, 255, 0.9));
  border-radius: 14px;
  padding: 9px 11px;
  font-size: 13px;
  color: #335471;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(67, 111, 148, 0.1);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.msg-highlight {
  animation: pulse-highlight 1.4s ease;
}

.msg {
  max-width: min(72%, 680px);
  border-radius: 20px;
  border: 1px solid rgba(130, 169, 204, 0.28);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 251, 255, 0.92));
  padding: 11px 13px;
  box-shadow: 0 10px 22px rgba(69, 102, 132, 0.08);
  justify-self: start;
  animation: message-pop 0.24s ease;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.msg:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(69, 102, 132, 0.14);
}

.msg.grouped {
  margin-top: -2px;
}

.msg.new-appear {
  animation: message-fade-in 0.32s ease;
}

.msg.grouped .msg-text {
  margin-top: 0;
}

.msg.mine {
  justify-self: end;
  border-color: rgba(102, 176, 238, 0.4);
  background: linear-gradient(180deg, rgba(232, 245, 255, 0.98), rgba(220, 239, 255, 0.92));
}

.msg.selected {
  outline: 2px solid rgba(67, 154, 227, 0.46);
  outline-offset: 1px;
  position: relative;
}

.msg-select-marker {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: linear-gradient(180deg, #4db0ff, #2f94f3);
  color: #fff;
  display: inline-grid;
  place-items: center;
  box-shadow: 0 8px 14px rgba(47, 148, 243, 0.22);
  animation: selection-marker-in 0.18s ease;
}

.msg.mine .msg-select-marker {
  left: 8px;
  right: auto;
}

.msg-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}

.msg-author {
  color: #597691;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.msg-text {
  margin-top: 3px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}

.msg-link {
  color: var(--blue-strong);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.msg-link:hover {
  opacity: 0.86;
}

.msg-image {
  margin-top: 8px;
  max-width: min(100%, 420px);
  max-height: 52vh;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid rgba(135, 174, 209, 0.42);
  background: rgba(236, 246, 255, 0.72);
  cursor: zoom-in;
}

.msg-reply {
  margin-top: 4px;
  padding: 7px 9px;
  border-left: 3px solid var(--blue);
  border-radius: 10px;
  background: rgba(61, 150, 228, 0.08);
  color: #58718a;
  font-size: 12px;
}

.msg-forwarded {
  margin-top: 4px;
  color: #4f83ad;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 10px;
  background: rgba(79, 131, 173, 0.08);
  border: 1px solid rgba(106, 160, 205, 0.18);
}

.msg-forwarded span {
  line-height: 1.2;
}

.msg-forwarded .ui-icon {
  opacity: 0.9;
}

.msg-meta {
  margin-top: 9px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.msg-read {
  font-size: 11px;
  color: #4a8fc7;
  letter-spacing: -0.3px;
}

.msg-time {
  color: var(--muted);
  font-size: 11px;
}

.msg-menu-btn {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--muted);
  font-size: 11px;
  padding: 2px 7px;
}

.context-menu {
  position: fixed;
  z-index: 60;
  min-width: 220px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  box-shadow: 0 16px 34px rgba(35, 63, 91, 0.24);
  padding: 6px;
  display: grid;
  gap: 4px;
}

.context-item {
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 8px 10px;
  font-size: 13px;
}

.context-item:hover {
  background: rgba(230, 245, 255, 0.82);
  border-color: rgba(125, 174, 215, 0.34);
}

.context-item.danger {
  color: var(--danger);
}

.msg.deleted .msg-text {
  color: var(--muted);
  font-style: italic;
}

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

.reaction-chip {
  border: 1px solid rgba(129, 169, 205, 0.36);
  border-radius: 999px;
  background: rgba(248, 252, 255, 0.88);
  color: #5e7690;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 700;
}

.reaction-chip.me {
  border-color: rgba(108, 173, 230, 0.5);
  background: rgba(229, 244, 255, 0.98);
  box-shadow: 0 8px 16px rgba(82, 151, 214, 0.12);
}

.composer {
  border-top: 1px solid var(--line);
  padding: 10px 12px 12px;
  position: relative;
  background: linear-gradient(180deg, rgba(250, 253, 255, 0.78), rgba(241, 247, 252, 0.94));
  box-shadow: 0 -12px 24px rgba(48, 91, 133, 0.07);
}

.composer-notice {
  border-top: 1px solid var(--line);
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(250, 253, 255, 0.78), rgba(241, 247, 252, 0.94));
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.composer::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(47, 148, 243, 0.3), transparent);
}

.compose-meta {
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(243, 250, 255, 0.82);
  color: var(--muted);
  font-size: 12px;
  padding: 6px 8px;
}

.image-preview-bar {
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(243, 250, 255, 0.86);
  padding: 6px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 8px;
}

.image-preview-bar img {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid rgba(133, 176, 211, 0.42);
}

.image-preview-meta {
  min-width: 0;
}

.image-preview-meta strong {
  display: block;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.image-viewer {
  display: grid;
  gap: 10px;
}

.image-viewer-img {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(249, 253, 255, 0.84);
}

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

.shared-media-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.66);
  overflow: hidden;
  text-align: left;
}

.file-box {
  margin-top: 8px;
  border: 1px solid rgba(129, 169, 205, 0.32);
  border-radius: 14px;
  background: rgba(246, 251, 255, 0.88);
  padding: 9px 10px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.file-kind-badge {
  min-width: 46px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(88, 176, 244, 0.18), rgba(47, 148, 243, 0.12));
  border: 1px solid rgba(98, 165, 223, 0.26);
  color: #3c78a9;
  display: inline-grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.file-kind-badge.kind-pdf {
  color: #b84f4f;
  background: linear-gradient(180deg, rgba(255, 236, 236, 0.94), rgba(255, 223, 223, 0.88));
}

.file-kind-badge.kind-doc,
.file-kind-badge.kind-txt {
  color: #356f9d;
}

.file-kind-badge.kind-xls,
.file-kind-badge.kind-csv {
  color: #2f7d57;
  background: linear-gradient(180deg, rgba(233, 249, 240, 0.94), rgba(221, 243, 231, 0.88));
}

.file-kind-badge.kind-zip,
.file-kind-badge.kind-7z,
.file-kind-badge.kind-rar {
  color: #8d6a2d;
  background: linear-gradient(180deg, rgba(255, 246, 230, 0.94), rgba(251, 238, 212, 0.88));
}

.file-box-main {
  min-width: 0;
}

.file-box-main strong,
.file-box-main p {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-box-actions {
  display: flex;
  gap: 6px;
}

.file-list {
  display: grid;
  gap: 8px;
}

.file-box.shared {
  margin-top: 0;
}

.forward-preview-item {
  border: 1px solid rgba(124, 167, 203, 0.22);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.62);
  padding: 8px 10px;
}

.shared-media-card.image img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

.shared-media-card.image .msg-time {
  padding: 8px 10px;
}

.upload-progress {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, #55b6ff, #2f94f3);
  width: 0;
  margin-bottom: 8px;
  box-shadow: 0 6px 14px rgba(47, 148, 243, 0.32);
  transition: width 0.14s ease;
}

#composeMetaText {
  cursor: pointer;
}

#composeMetaText:hover {
  text-decoration: underline;
}

.composer-row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

.composer-row input {
  min-width: 0;
  border: 1px solid rgba(124, 167, 203, 0.24);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
  padding: 12px 16px;
  border-radius: 20px;
}

.composer-row input:focus {
  border-color: rgba(71, 158, 232, 0.42);
  box-shadow: 0 0 0 4px rgba(71, 158, 232, 0.1), 0 10px 22px rgba(47, 148, 243, 0.12);
  transform: translateY(-1px);
}

.composer-row .icon-btn,
.composer-row .emoji-btn {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(124, 167, 203, 0.24);
  box-shadow: 0 8px 18px rgba(47, 95, 139, 0.08);
}

#attachToggleBtn {
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(237, 246, 253, 0.74));
  box-shadow: 0 10px 20px rgba(48, 96, 140, 0.12);
}


#sendBtn {
  min-width: 146px;
  height: 46px;
  border-radius: 18px;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 14px 26px rgba(47, 148, 243, 0.22);
}

.attach-menu,
.emoji-panel {
  position: absolute;
  bottom: calc(100% + 8px);
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
  box-shadow: 0 16px 30px rgba(65, 99, 129, 0.2);
  animation: reveal 0.16s ease;
}

.attach-menu {
  left: 10px;
  padding: 8px;
  display: grid;
  gap: 6px;
}

.attach-menu button {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.86);
  text-align: left;
  padding: 7px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.emoji-panel {
  left: 56px;
  width: min(305px, 72vw);
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.emoji-btn {
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  padding: 5px 0;
}

.emoji-btn:hover {
  border-color: rgba(130, 170, 205, 0.35);
  background: rgba(255, 255, 255, 0.75);
}

.poll-box {
  margin-top: 8px;
  border: 1px solid rgba(140, 179, 213, 0.35);
  border-radius: 11px;
  background: rgba(246, 251, 255, 0.84);
  padding: 7px;
  display: grid;
  gap: 6px;
}

.poll-option {
  border: 1px solid rgba(138, 177, 210, 0.34);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.84);
  padding: 8px 10px;
  text-align: left;
  display: grid;
  gap: 6px;
}

.poll-option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.poll-progress {
  height: 7px;
  border-radius: 999px;
  background: rgba(126, 167, 203, 0.18);
  overflow: hidden;
}

.poll-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #69b8ff, #2f94f3);
}

.poll-votes-meta {
  color: var(--muted);
  font-size: 11px;
}

.poll-overview-card {
  border: 1px solid rgba(138, 177, 210, 0.28);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.66);
  padding: 10px;
  display: grid;
  gap: 8px;
}

.compact-list {
  gap: 6px;
}

.member-preview-item.compact {
  padding: 8px 10px;
  box-shadow: none;
}

.compact-empty {
  padding: 10px 12px;
}

.poll-option.voted {
  border-color: rgba(90, 158, 221, 0.5);
  background: rgba(225, 241, 255, 0.9);
}

.side-menu {
  position: fixed;
  z-index: 34;
  left: 14px;
  top: 14px;
  bottom: 14px;
  width: min(365px, calc(100vw - 28px));
  border: 1px solid rgba(130, 171, 207, 0.4);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.52);
  backdrop-filter: blur(22px);
  box-shadow: 0 24px 55px rgba(32, 61, 91, 0.28);
  padding: 12px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 12px;
  min-height: 0;
  transform: translateX(-118%);
  transition: transform 0.24s ease;
}

.side-menu.open {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.menu-account {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.58);
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 9px;
}

.menu-account .avatar {
  width: 34px;
  height: 34px;
  font-size: 11px;
}

.menu-account strong {
  display: block;
  font-size: 14px;
}

.menu-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.menu-actions {
  display: grid;
  gap: 7px;
  align-content: start;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.menu-section-title {
  padding: 4px 2px 2px;
  color: #7a97b2;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.menu-link {
  border: 1px solid rgba(123, 169, 205, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.5);
  color: #5f7892;
  padding: 9px 10px;
  text-align: left;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
}

.menu-link::after {
  content: "›";
  color: #84a1bb;
  font-size: 14px;
}

.menu-link:hover {
  background: rgba(246, 252, 255, 0.92);
  border-color: rgba(115, 173, 220, 0.45);
}

.menu-link-icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: rgba(228, 243, 255, 0.72);
  border: 1px solid rgba(123, 175, 220, 0.34);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.menu-link-icon .ui-icon {
  width: 15px;
  height: 15px;
}

.menu-link-main {
  display: grid;
  gap: 1px;
}

.menu-link-main strong {
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
}

.menu-link-main small {
  font-size: 10px;
  color: var(--muted);
}

.menu-badge {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  padding: 0 7px;
  background: linear-gradient(180deg, #53b4ff, #2f94f3);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 8px 14px rgba(47, 148, 243, 0.22);
}

.menu-link.active {
  border-color: rgba(121, 176, 226, 0.48);
  background: linear-gradient(180deg, rgba(237, 248, 255, 0.94), rgba(229, 244, 255, 0.88));
  color: #2f4f70;
}

.menu-logout {
  width: 100%;
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 700;
  justify-self: stretch;
}

.menu-section {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 10px;
}

.settings-list,
.menu-contacts {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.5);
  padding: 8px;
}

.settings-layout {
  gap: 10px;
}

.settings-card-quiet {
  background: rgba(255, 255, 255, 0.48);
  box-shadow: none;
}

.settings-layout > * {
  animation: reveal-soft 0.24s ease;
}

.settings-hero {
  border: 1px solid rgba(108, 163, 210, 0.28);
  border-radius: 16px;
  padding: 14px;
  background: linear-gradient(135deg, rgba(239, 248, 255, 0.92), rgba(225, 240, 252, 0.78));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.settings-hero strong {
  display: block;
  font-size: 16px;
  margin-bottom: 4px;
}

.settings-hero-brand {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 14px;
}

.settings-hero-copy {
  display: grid;
  gap: 2px;
}

.settings-hero-note {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.settings-hero-mark {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.settings-hero-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.settings-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.56);
  display: grid;
  gap: 10px;
}

.settings-card.warning {
  border-color: rgba(210, 146, 92, 0.34);
  background: linear-gradient(180deg, rgba(255, 245, 231, 0.78), rgba(255, 250, 242, 0.68));
}

.settings-card.success {
  border-color: rgba(87, 182, 143, 0.3);
  background: linear-gradient(180deg, rgba(232, 250, 241, 0.8), rgba(242, 252, 247, 0.7));
}

.settings-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.settings-card-head strong {
  display: block;
  font-size: 15px;
  margin-bottom: 2px;
}

.settings-theme-switcher {
  padding: 5px;
}

.settings-theme-switcher .seg-btn {
  min-height: 42px;
  font-weight: 700;
}

.settings-inline-value {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.settings-inline-value.disabled {
  opacity: 0.65;
}

.settings-status {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

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

.settings-actions-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.settings-actions-grid button {
  width: 100%;
  min-height: 40px;
}

.settings-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.notifications-grid {
  margin-top: 0;
}

.settings-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.72);
  text-align: center;
  font-size: 11px;
  font-weight: 600;
}

.settings-pill.disabled {
  color: var(--muted);
}

.settings-toggle {
  position: relative;
  width: 52px;
  min-width: 52px;
  height: 32px;
  display: inline-flex;
  align-items: center;
}

.settings-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.settings-toggle span {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: rgba(156, 181, 205, 0.46);
  border: 1px solid rgba(122, 162, 199, 0.32);
  position: relative;
  transition: all 0.18s ease;
}

.settings-toggle span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 4px 10px rgba(39, 70, 100, 0.18);
  transition: transform 0.18s ease;
}

.settings-toggle input:checked + span {
  background: linear-gradient(180deg, #55b5ff, #2f94f3);
  border-color: rgba(62, 149, 228, 0.48);
}

.settings-toggle input:checked + span::after {
  transform: translateX(20px);
}

.settings-toggle.disabled {
  opacity: 0.55;
}

.settings-device-list {
  display: grid;
  gap: 8px;
  max-height: 44vh;
  overflow: auto;
}

.settings-device-card {
  border: 1px solid rgba(130, 172, 205, 0.26);
  border-radius: 14px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.66);
  display: grid;
  gap: 5px;
}

.settings-device-card.current {
  border-color: rgba(79, 166, 233, 0.34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.settings-device-main {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.settings-empty {
  border: 1px dashed rgba(126, 166, 199, 0.32);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  background: rgba(255, 255, 255, 0.44);
}

.room-link-box {
  text-align: left;
  width: 100%;
}

.skeleton-card {
  overflow: hidden;
  position: relative;
}

.skeleton-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.2s infinite;
}

.skeleton-line {
  height: 11px;
  border-radius: 999px;
  background: rgba(151, 182, 209, 0.22);
}

.skeleton-line.lg {
  height: 16px;
  width: 72%;
}

.skeleton-line.short {
  width: 44%;
}

.profile-hero-main {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.profile-hero-copy {
  display: grid;
  gap: 4px;
}

.profile-hero-avatar {
  width: 60px;
  height: 60px;
  font-size: 16px;
}

.room-profile-layout {
  gap: 10px;
}

.room-profile-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

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

.profile-summary-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

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

.profile-action-row .ghost {
  min-height: 36px;
  padding: 8px 12px;
}

.room-profile-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
}

.room-profile-panel {
  animation: reveal-soft 0.2s ease;
}

.room-summary-grid {
  grid-template-columns: repeat(2, 1fr);
}

.moderation-summary-grid {
  margin-bottom: 6px;
}

.member-preview-list {
  display: grid;
  gap: 8px;
}

.member-preview-item {
  border: 1px solid rgba(124, 167, 203, 0.24);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(245, 250, 255, 0.66));
  padding: 10px 12px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  text-align: left;
  box-shadow: 0 10px 20px rgba(52, 96, 135, 0.08);
}

.member-preview-item.banned {
  background: linear-gradient(180deg, rgba(255, 244, 244, 0.86), rgba(255, 236, 236, 0.78));
  border-color: rgba(214, 129, 129, 0.28);
}

.member-preview-item.request {
  background: linear-gradient(180deg, rgba(243, 248, 255, 0.9), rgba(236, 245, 255, 0.82));
  border-color: rgba(109, 165, 214, 0.28);
}

.member-preview-item .member-actions {
  align-self: center;
}

.request-actions {
  grid-template-columns: 1fr;
  justify-items: stretch;
  min-width: 112px;
}

.member-preview-item strong {
  display: block;
  margin-bottom: 2px;
}

.member-badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.member-badges-row .role-chip {
  margin-left: 0;
}

.member-preview-arrow {
  color: var(--muted);
  display: inline-grid;
  place-items: center;
}

.room-media-strip {
  display: flex;
  gap: 8px;
  overflow: auto;
}

.room-media-strip-item,
.room-media-strip-more {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  border: 1px solid rgba(124, 167, 203, 0.24);
  background: rgba(255, 255, 255, 0.72);
  overflow: hidden;
  flex: 0 0 auto;
}

.room-media-strip-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.room-media-strip-more {
  display: inline-grid;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
}

.avatar.small {
  width: 32px;
  height: 32px;
  font-size: 10px;
}

.profile-mode-switcher {
  padding: 5px;
}

.settings-contact-card {
  grid-template-columns: auto 1fr auto;
  text-align: left;
}

.contacts-modal-list {
  max-height: 48vh;
}

.room-members-list {
  max-height: 42vh;
}

.about-grid {
  grid-template-columns: repeat(2, 1fr);
}

.about-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 14px;
}

.about-hero-mark {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.about-hero-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.about-card-head {
  align-items: center;
}

.search-results-list {
  max-height: 42vh;
}

.settings-list {
  display: grid;
  gap: 8px;
  color: #5f768e;
  font-size: 13px;
}

.menu-contacts {
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
}

.menu-contact-item {
  border: 1px solid rgba(139, 177, 211, 0.3);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 7px;
}

.menu-contact-item.with-action {
  grid-template-columns: auto 1fr auto;
}

.member-actions {
  display: grid;
  gap: 6px;
  justify-items: end;
}

.member-menu-btn {
  width: 30px;
  height: 30px;
  border-radius: 10px;
}

.compact-btn {
  padding: 6px 8px;
  font-size: 12px;
  white-space: nowrap;
}

.role-chip {
  display: inline-block;
  margin-left: 6px;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
}

.role-chip.owner {
  border-color: rgba(223, 163, 88, 0.45);
  color: #8a5f2b;
  background: rgba(255, 237, 214, 0.8);
}

.role-chip.admin {
  border-color: rgba(104, 169, 227, 0.45);
  color: #2f5c86;
  background: rgba(225, 241, 255, 0.82);
}

.role-chip.member {
  border-color: rgba(123, 154, 186, 0.28);
  color: #65809a;
  background: rgba(242, 247, 251, 0.82);
}

.role-chip.warning {
  border-color: rgba(216, 157, 97, 0.34);
  color: #9b6325;
  background: rgba(255, 243, 225, 0.88);
}

.role-chip.restricted {
  border-color: rgba(200, 118, 118, 0.34);
  color: #8c4a4a;
  background: rgba(255, 235, 235, 0.86);
}

.role-chip.pending {
  border-color: rgba(106, 164, 216, 0.34);
  color: #336e9e;
  background: rgba(231, 244, 255, 0.9);
}

.menu-contact-item:hover {
  background: rgba(243, 250, 255, 0.88);
}

.menu-contact-item.sent {
  opacity: 0.7;
}

.invite-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.64);
  padding: 10px;
  display: grid;
  gap: 8px;
}

.invite-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.invite-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.admin-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.44);
  display: grid;
  gap: 8px;
}

.admin-console-layout {
  gap: 10px;
}

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

.admin-panel {
  max-height: min(62vh, 620px);
  overflow: auto;
}

.compact-stack {
  gap: 6px;
}

.compact-grid {
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
}

.admin-stats {
  color: var(--muted);
  font-size: 12px;
  display: grid;
  gap: 3px;
}

.admin-kpi-grid .settings-pill {
  text-align: left;
}

.admin-users {
  display: grid;
  gap: 6px;
  max-height: 52vh;
  overflow: auto;
}

.admin-user {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.62);
  padding: 7px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.admin-user-main {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
}

.admin-user-actions {
  display: grid;
  gap: 6px;
  align-content: start;
  min-width: 108px;
}

.danger {
  color: var(--danger);
  border-color: rgba(217, 123, 123, 0.36);
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(145, 184, 217, 0.4);
  background: linear-gradient(145deg, #6fb2e8, #79d4b3);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  letter-spacing: 0.04em;
}

.avatar .ui-icon {
  width: 16px;
  height: 16px;
}

.avatar .support-avatar-glyph {
  width: 20px;
  height: 20px;
}

.profile-hero-avatar .support-avatar-glyph {
  width: 30px;
  height: 30px;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.presence {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #c4d1dd;
}

.presence.online {
  background: #37c775;
  box-shadow: 0 0 10px rgba(55, 199, 117, 0.45);
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: end center;
  background: rgba(30, 47, 66, 0.35);
}

body[data-theme="dark"] {
  color-scheme: dark;
}

body[data-theme="dark"] .segmented,
body[data-theme="dark"] .seg-btn.active,
body[data-theme="dark"] input,
body[data-theme="dark"] textarea,
body[data-theme="dark"] select,
body[data-theme="dark"] .ghost,
body[data-theme="dark"] .icon-btn,
body[data-theme="dark"] .chat-item:hover,
body[data-theme="dark"] .chat-item.active,
body[data-theme="dark"] .msg,
body[data-theme="dark"] .msg-menu-btn,
body[data-theme="dark"] .reaction-chip,
body[data-theme="dark"] .compose-meta,
body[data-theme="dark"] .image-preview-bar,
body[data-theme="dark"] .attach-menu,
body[data-theme="dark"] .emoji-panel,
body[data-theme="dark"] .attach-menu button,
body[data-theme="dark"] .emoji-btn:hover,
body[data-theme="dark"] .poll-box,
body[data-theme="dark"] .poll-option,
body[data-theme="dark"] .menu-link,
body[data-theme="dark"] .settings-list,
body[data-theme="dark"] .menu-contacts,
body[data-theme="dark"] .menu-contact-item,
body[data-theme="dark"] .menu-contact-item:hover,
body[data-theme="dark"] .invite-card,
body[data-theme="dark"] .admin-box,
body[data-theme="dark"] .admin-user,
body[data-theme="dark"] .chat-item-badge,
body[data-theme="dark"] .context-menu,
body[data-theme="dark"] .sheet-card {
  background: rgba(22, 36, 50, 0.86);
  color: var(--text);
  border-color: rgba(103, 145, 181, 0.38);
}

body[data-theme="dark"] .chat-item {
  background: rgba(18, 31, 44, 0.32);
  border-color: rgba(101, 142, 178, 0.14);
}

body[data-theme="dark"] .chat-item:hover {
  background: rgba(28, 45, 61, 0.7);
  border-color: rgba(102, 160, 210, 0.24);
}

body[data-theme="dark"] .chat-item.active {
  background: linear-gradient(180deg, rgba(36, 66, 92, 0.92), rgba(30, 57, 80, 0.9));
  border-color: rgba(98, 158, 208, 0.36);
  box-shadow: inset 2px 0 0 #56b0ff, 0 10px 16px rgba(6, 15, 24, 0.18);
}

body[data-theme="dark"] .chat-list-time {
  color: #8ba1b7;
}

body[data-theme="dark"] .chat-list-preview {
  color: #9ab0c4;
}

body[data-theme="dark"] .chat-item-arrow {
  color: #8aa4ba;
}

body[data-theme="dark"] .context-item:hover {
  background: rgba(41, 74, 102, 0.7);
}

body[data-theme="dark"] .chat-item-badge.lock {
  background: rgba(86, 64, 37, 0.55);
  color: #f0c58c;
}

body[data-theme="dark"] .chat-item-badge.public {
  background: rgba(27, 63, 91, 0.6);
  color: #9fd0fb;
}

body[data-theme="dark"] .chat-item-badge.dm {
  background: rgba(34, 57, 79, 0.74);
  color: #b8d8f4;
}

body[data-theme="dark"] .chat-item-badge.online {
  background: rgba(29, 69, 53, 0.72);
  color: #bcebcf;
}

body[data-theme="dark"] .chat-mini-flag {
  background: rgba(32, 53, 72, 0.76);
  border-color: rgba(102, 146, 183, 0.28);
}

body[data-theme="dark"] .chat-item-badge.manage {
  background: rgba(33, 58, 83, 0.72);
  color: #b5d7f5;
}

body[data-theme="dark"] .chat-item::before {
  color: #9fc8ea;
}

body[data-theme="dark"] .msg-read {
  color: #8ec7f5;
}

body[data-theme="dark"] .date-separator {
  background: rgba(32, 57, 78, 0.82);
  border-color: rgba(106, 154, 194, 0.4);
  color: #9fc4e4;
}

body[data-theme="dark"] .date-separator.unread-separator {
  background: rgba(32, 69, 99, 0.86);
  border-color: rgba(115, 177, 228, 0.56);
  color: #c4e8ff;
}

body[data-theme="dark"] .sticky-day {
  background: rgba(31, 58, 81, 0.92);
  border-color: rgba(107, 160, 205, 0.54);
  color: #c6e6ff;
}

body[data-theme="dark"] .chat-more-btn {
  background: rgba(29, 50, 69, 0.82);
  border-color: rgba(100, 146, 184, 0.42);
  color: #9dc4e7;
}

body[data-theme="dark"] .menu-account {
  background: rgba(26, 44, 60, 0.86);
  border-color: rgba(101, 143, 177, 0.42);
}

body[data-theme="dark"] .toast {
  background: rgba(24, 41, 57, 0.94);
}

body[data-theme="dark"] .update-banner {
  background: linear-gradient(180deg, rgba(35, 63, 87, 0.92), rgba(28, 54, 77, 0.86));
  border-color: rgba(104, 164, 211, 0.38);
}

body[data-theme="dark"] .empty-panel,
body[data-theme="dark"] .empty-chat-state {
  background: rgba(26, 43, 60, 0.74);
  border-color: rgba(103, 143, 178, 0.34);
}

body[data-theme="dark"] .room-tools {
  background: linear-gradient(180deg, rgba(34, 56, 76, 0.5), rgba(23, 40, 56, 0.28));
  border-color: rgba(101, 144, 179, 0.24);
}

body[data-theme="dark"] .menu-link-icon {
  background: rgba(35, 68, 95, 0.78);
  border-color: rgba(108, 157, 198, 0.5);
}

body[data-theme="dark"] .menu-link::after {
  color: #93b9da;
}

body[data-theme="dark"] .menu-link:hover {
  background: rgba(35, 57, 77, 0.9);
  border-color: rgba(118, 169, 208, 0.52);
}

body[data-theme="dark"] .menu-section-title {
  color: #86a9c8;
}

body[data-theme="dark"] .settings-hero {
  background: linear-gradient(135deg, rgba(31, 55, 76, 0.92), rgba(25, 43, 60, 0.84));
  border-color: rgba(99, 147, 186, 0.34);
}

body[data-theme="dark"] .settings-card {
  background: rgba(25, 42, 59, 0.72);
  border-color: rgba(101, 143, 177, 0.34);
}

body[data-theme="dark"] .settings-card.warning {
  background: linear-gradient(180deg, rgba(78, 57, 33, 0.64), rgba(55, 40, 23, 0.58));
  border-color: rgba(186, 145, 100, 0.36);
}

body[data-theme="dark"] .settings-card.success {
  background: linear-gradient(180deg, rgba(32, 74, 60, 0.64), rgba(26, 57, 47, 0.58));
  border-color: rgba(92, 170, 136, 0.34);
}

body[data-theme="dark"] .settings-hero-mark img {
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.2));
}

body[data-theme="dark"] .settings-pill {
  background: rgba(31, 53, 73, 0.82);
}

body[data-theme="dark"] .settings-device-card,
body[data-theme="dark"] .settings-empty {
  background: rgba(29, 48, 65, 0.74);
  border-color: rgba(102, 143, 177, 0.32);
}

body[data-theme="dark"] .member-preview-item,
body[data-theme="dark"] .room-media-strip-item,
body[data-theme="dark"] .room-media-strip-more {
  background: rgba(29, 48, 65, 0.78);
  border-color: rgba(102, 143, 177, 0.3);
}

body[data-theme="dark"] .member-preview-item.banned {
  background: linear-gradient(180deg, rgba(78, 40, 40, 0.74), rgba(63, 33, 33, 0.66));
  border-color: rgba(203, 118, 118, 0.3);
}

body[data-theme="dark"] .member-preview-item.request {
  background: linear-gradient(180deg, rgba(32, 58, 81, 0.78), rgba(27, 49, 69, 0.7));
  border-color: rgba(104, 162, 209, 0.3);
}

body[data-theme="dark"] .poll-overview-card {
  background: rgba(29, 48, 65, 0.78);
  border-color: rgba(102, 143, 177, 0.28);
}

body[data-theme="dark"] .file-box {
  background: rgba(29, 48, 65, 0.78);
  border-color: rgba(102, 143, 177, 0.3);
}

body[data-theme="dark"] .file-kind-badge {
  background: linear-gradient(180deg, rgba(61, 120, 170, 0.26), rgba(44, 94, 140, 0.18));
  border-color: rgba(98, 156, 206, 0.28);
  color: #a8d5fb;
}

body[data-theme="dark"] .forward-preview-item {
  background: rgba(29, 48, 65, 0.74);
  border-color: rgba(102, 143, 177, 0.24);
}

body[data-theme="dark"] .skeleton-line {
  background: rgba(114, 149, 180, 0.22);
}

body[data-theme="dark"] .skeleton-card::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
}

body[data-theme="dark"] .settings-contact-card {
  background: rgba(29, 48, 65, 0.82);
}

body[data-theme="dark"] .jump-bottom {
  background: rgba(32, 57, 79, 0.92);
  border-color: rgba(107, 160, 205, 0.52);
  color: #d7ebff;
}

body[data-theme="dark"] .filter-chip {
  background: rgba(25, 43, 59, 0.76);
  border-color: rgba(99, 140, 176, 0.42);
  color: #9ab6cc;
}

body[data-theme="dark"] .filter-chip.active {
  background: linear-gradient(180deg, rgba(56, 118, 170, 0.5), rgba(36, 95, 145, 0.62));
  border-color: rgba(108, 168, 218, 0.66);
  color: #dceefe;
}

body[data-theme="dark"] .chat-head,
body[data-theme="dark"] .composer {
  background: rgba(17, 30, 43, 0.78);
}

body[data-theme="dark"] .composer-notice {
  background: rgba(17, 30, 43, 0.78);
}

body[data-theme="dark"] .chat-head.selection-mode {
  background: linear-gradient(180deg, rgba(28, 58, 84, 0.96), rgba(24, 49, 70, 0.92));
  border-bottom-color: rgba(103, 170, 223, 0.34);
  box-shadow: inset 0 -1px 0 rgba(95, 171, 235, 0.14), 0 12px 26px rgba(8, 18, 29, 0.22);
}

body[data-theme="dark"] .composer-row input,
body[data-theme="dark"] .composer-row .icon-btn,
body[data-theme="dark"] .composer-row .emoji-btn {
  background: rgba(27, 46, 63, 0.88);
  border-color: rgba(103, 145, 181, 0.3);
}

body[data-theme="dark"] #attachToggleBtn {
  background: linear-gradient(180deg, rgba(39, 62, 82, 0.96), rgba(31, 51, 70, 0.9));
}

body[data-theme="dark"] .panel {
  background: linear-gradient(180deg, rgba(26, 42, 58, 0.88), rgba(22, 36, 50, 0.84));
}

body[data-theme="dark"] .panel::before {
  background: linear-gradient(90deg, transparent, rgba(151, 193, 227, 0.32), transparent);
}

body[data-theme="dark"] .chat-unread {
  background: linear-gradient(180deg, #3d9cf2, #246fb5);
}

body[data-theme="dark"] .pinned-banner {
  background: linear-gradient(180deg, rgba(31, 57, 81, 0.86), rgba(27, 49, 70, 0.8));
  border-color: rgba(108, 160, 206, 0.46);
  color: #b8d9f5;
}

body[data-theme="dark"] .chat-item.active {
  background: linear-gradient(180deg, rgba(36, 55, 74, 0.92), rgba(31, 49, 67, 0.86));
}

body[data-theme="dark"] .image-viewer-img {
  background: rgba(20, 36, 50, 0.88);
}

body[data-theme="dark"] .messages {
  background: linear-gradient(180deg, rgba(14, 26, 37, 0.58), rgba(12, 24, 35, 0.44));
}

body[data-theme="dark"] .messages.drop-active {
  outline-color: rgba(109, 177, 235, 0.68);
}

body[data-theme="dark"] .msg.mine {
  background: linear-gradient(180deg, rgba(37, 79, 113, 0.84), rgba(31, 68, 99, 0.9));
  border-color: rgba(98, 154, 205, 0.5);
}

body[data-theme="dark"] .msg-reply {
  background: rgba(58, 113, 163, 0.28);
  color: #a9c5de;
}

body[data-theme="dark"] .msg-forwarded {
  color: #8fc3ee;
  background: rgba(56, 104, 145, 0.18);
  border-color: rgba(107, 165, 214, 0.22);
}

body[data-theme="dark"] .msg-link {
  color: #8fc3ee;
}

body[data-theme="dark"] .msg {
  background: linear-gradient(180deg, rgba(28, 45, 61, 0.94), rgba(23, 38, 53, 0.9));
  border-color: rgba(95, 139, 177, 0.26);
}

body[data-theme="dark"] .shared-media-card {
  background: rgba(29, 48, 65, 0.78);
  border-color: rgba(103, 145, 181, 0.3);
}

body[data-theme="dark"] .msg-author {
  color: #a9c5de;
}

body[data-theme="dark"] .reaction-chip {
  background: rgba(31, 53, 73, 0.84);
  color: #b8d3e8;
}

body[data-theme="dark"] .reaction-chip.me,
body[data-theme="dark"] .poll-option.voted,
body[data-theme="dark"] .menu-link.active {
  background: rgba(46, 91, 129, 0.62);
  border-color: rgba(110, 170, 224, 0.55);
}

body[data-theme="dark"] .role-chip {
  background: rgba(30, 48, 65, 0.78);
  border-color: rgba(108, 151, 189, 0.45);
  color: #a8c2d8;
}

body[data-theme="dark"] .role-chip.owner {
  background: rgba(86, 64, 37, 0.55);
  border-color: rgba(218, 171, 110, 0.45);
  color: #f0c58c;
}

body[data-theme="dark"] .role-chip.admin {
  background: rgba(34, 72, 104, 0.66);
  border-color: rgba(103, 159, 208, 0.55);
  color: #9fd0fb;
}

body[data-theme="dark"] .role-chip.warning {
  background: rgba(92, 64, 32, 0.6);
  border-color: rgba(216, 167, 104, 0.42);
  color: #f3ca8f;
}

body[data-theme="dark"] .role-chip.restricted {
  background: rgba(89, 45, 45, 0.62);
  border-color: rgba(210, 124, 124, 0.42);
  color: #f2b3b3;
}

body[data-theme="dark"] .role-chip.pending {
  background: rgba(34, 70, 100, 0.66);
  border-color: rgba(104, 162, 209, 0.46);
  color: #abd6fa;
}

body[data-theme="dark"] .primary {
  box-shadow: 0 10px 18px rgba(32, 114, 188, 0.35);
}

body[data-theme="dark"] .msg-time,
body[data-theme="dark"] .chat-item-main p,
body[data-theme="dark"] .me-mini p,
body[data-theme="dark"] label span,
body[data-theme="dark"] .msg-author,
body[data-theme="dark"] .settings-list,
body[data-theme="dark"] .menu-link,
body[data-theme="dark"] .icon-btn {
  color: var(--muted);
}

body[data-theme="dark"] .presence {
  background: #4f657a;
}

body[data-theme="dark"] .presence.online {
  background: #37c775;
  box-shadow: 0 0 10px rgba(55, 199, 117, 0.45);
}

.sheet-card {
  width: min(530px, 100%);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(15px);
  box-shadow: 0 -15px 35px rgba(34, 63, 91, 0.2);
  padding: 14px;
  animation: sheet-up 0.2s ease;
  max-height: min(88vh, 900px);
  overflow: auto;
}

.sheet-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  position: sticky;
  top: -14px;
  z-index: 2;
  padding-top: 4px;
  padding-bottom: 8px;
  background: inherit;
  backdrop-filter: blur(15px);
}

.sheet-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  position: sticky;
  bottom: 0;
  background: inherit;
  padding-bottom: 2px;
}

.sheet-action {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s;
}

.sheet-action:hover {
  background: var(--hover);
}

.mobile-only {
  display: none;
}

.hidden {
  display: none !important;
}

.chat-list,
.messages,
.menu-contacts,
.admin-users,
.sheet-card {
  scrollbar-width: thin;
  scrollbar-color: rgba(121, 163, 198, 0.5) transparent;
}

.chat-list::-webkit-scrollbar,
.messages::-webkit-scrollbar,
.menu-contacts::-webkit-scrollbar,
.admin-users::-webkit-scrollbar,
.sheet-card::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.chat-list::-webkit-scrollbar-thumb,
.messages::-webkit-scrollbar-thumb,
.menu-contacts::-webkit-scrollbar-thumb,
.admin-users::-webkit-scrollbar-thumb,
.sheet-card::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(102, 162, 215, 0.55), rgba(91, 149, 200, 0.45));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.chat-list::-webkit-scrollbar-track,
.messages::-webkit-scrollbar-track,
.menu-contacts::-webkit-scrollbar-track,
.admin-users::-webkit-scrollbar-track,
.sheet-card::-webkit-scrollbar-track {
  background: transparent;
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes reveal-soft {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

@keyframes message-pop {
  from {
    opacity: 0;
    transform: scale(0.985);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes message-fade-in {
  from {
    opacity: 0.55;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes selection-marker-in {
  from {
    opacity: 0;
    transform: scale(0.7);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes selection-head-in {
  from {
    opacity: 0.85;
    transform: translateY(-2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(10px, -8px);
  }
}

@keyframes sheet-up {
  from {
    transform: translateY(14px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes pulse-highlight {
  0% {
    box-shadow: 0 0 0 0 rgba(69, 168, 255, 0.45);
  }
  70% {
    box-shadow: 0 0 0 18px rgba(69, 168, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(69, 168, 255, 0);
  }
}

@keyframes unread-pop {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

@media (max-width: 900px) {
  .auth-view {
    padding: 14px;
  }

  .auth-shell {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .auth-hero {
    min-height: 0;
    padding: 20px;
  }

  .auth-card {
    padding: 20px;
    border-radius: 22px;
  }

  body {
    overflow: hidden;
    height: var(--app-height);
    position: fixed;
    inset: 0;
    width: 100%;
  }

  html,
  .root {
    height: var(--app-height);
    min-height: var(--app-height);
    overflow: hidden;
  }

  .root {
    position: fixed;
    left: 0;
    right: 0;
    top: var(--app-top);
    width: 100%;
  }

  .chat-view {
    padding: 0;
    min-height: var(--app-height);
    height: var(--app-height);
  }

  .app-shell {
    height: var(--app-height);
    grid-template-columns: 1fr;
    gap: 0;
  }

  .center-panel {
    border-radius: 0;
    border: none;
    height: var(--app-height);
    position: fixed;
    left: 0;
    right: 0;
    top: var(--app-top);
    display: block;
    overflow: hidden;
    overscroll-behavior: none;
    z-index: 1;
  }

  .left-panel {
    position: fixed;
    z-index: 30;
    left: 0;
    top: 0;
    bottom: 0;
    width: 100vw;
    border-radius: 0;
    border: none;
    transform: translateX(-118%);
    transition: transform 0.22s ease;
    overflow: hidden;
  }

  .left-panel.open {
    transform: translateX(0);
  }

  .mobile-only {
    display: inline-grid;
    place-items: center;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
  }

  .chat-more-btn {
    width: 26px;
    height: 24px;
    font-size: 15px;
  }

  .chat-head {
    position: fixed;
    top: var(--app-top);
    left: 0;
    right: 0;
    z-index: 3;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(10px);
    padding: 8px 6px;
    gap: 6px;
  }

  .chat-head-main {
    min-width: 0;
    gap: 7px;
  }

  .chat-head-main .avatar {
    width: 36px;
    height: 36px;
  }

  .chat-item {
    padding: 7px 8px;
    gap: 8px;
  }

  .chat-item .avatar {
    width: 36px;
    height: 36px;
  }

  .chat-list-preview {
    padding-right: 0;
  }

  .chat-head-main p {
    max-width: 38vw;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .chat-head-main h3 {
    font-size: 14px;
  }

  .chat-head-actions {
    gap: 4px;
    flex-shrink: 0;
  }

  .update-banner {
    position: absolute;
    top: calc(var(--chat-head-height, 58px) - 4px);
    left: 8px;
    right: 8px;
    z-index: 3;
    margin: 0;
  }

  .left-panel {
    padding: max(10px, env(safe-area-inset-top)) 10px max(12px, env(safe-area-inset-bottom));
  }

  .room-tools {
    gap: 8px;
    padding: 8px;
    border-radius: 16px;
  }

  .room-tools-head {
    align-items: center;
  }

  .room-tool-btn {
    width: 32px;
    height: 32px;
  }

  .list-filters {
    gap: 5px;
  }

  .filter-chip {
    padding: 6px 10px;
  }

  .chat-item {
    padding: 8px 8px;
    border-radius: 16px;
  }

  .room-card-headline {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .room-card-badges {
    gap: 5px;
    margin: 4px 0 5px;
  }

  .chat-item-main p {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .chat-item-tail {
    min-width: 50px;
    align-self: stretch;
  }

  #chatActionsBtn {
    min-width: 92px;
    padding: 7px 10px;
    font-size: 12px;
  }

  .msg {
    max-width: 92%;
  }

  .chat-item:hover,
  .msg:hover {
    transform: none;
  }

  .messages {
    position: absolute;
    top: var(--chat-head-height, 58px);
    left: 0;
    right: 0;
    bottom: var(--composer-height, 72px);
    padding: 8px 6px 12px;
    overflow-y: auto;
    overscroll-behavior: none;
  }

  .jump-bottom {
    right: 8px;
    bottom: 92px;
  }

  .sticky-day {
    top: 54px;
  }

  .pinned-banner {
    font-size: 12px;
  }

  .composer-row {
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    gap: 5px;
    padding: 0;
  }

  #sendBtn {
    grid-column: auto;
    min-width: 48px;
    width: 48px;
    height: 42px;
    border-radius: 14px;
    font-size: 0;
    padding: 0;
    position: relative;
  }

  #sendBtn::before {
    content: "";
    width: 18px;
    height: 18px;
    display: block;
    background: currentColor;
    -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m5 12 13-6-3.5 12-4-4-5.5-2Z" fill="none" stroke="black" stroke-width="1.8" stroke-linejoin="round" stroke-linecap="round"/></svg>') center/contain no-repeat;
    mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m5 12 13-6-3.5 12-4-4-5.5-2Z" fill="none" stroke="black" stroke-width="1.8" stroke-linejoin="round" stroke-linecap="round"/></svg>') center/contain no-repeat;
  }

  #messageInput {
    font-size: 16px;
    min-height: 42px;
    padding: 9px 12px;
  }

  .composer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
    padding: 8px 8px calc(max(10px, env(safe-area-inset-bottom)) + 2px);
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  body.keyboard-open .chat-view,
  body.keyboard-open .app-shell,
  body.keyboard-open .center-panel {
    height: var(--app-height);
    min-height: var(--app-height);
  }

  body.keyboard-open .messages {
    bottom: var(--composer-height, 72px);
    padding-bottom: 4px;
  }

  body.keyboard-open .composer {
    bottom: 0;
  }

  body.keyboard-open .composer {
    padding-bottom: 6px;
  }

  body.keyboard-open .empty-chat-state {
    margin-bottom: 0;
  }

  .composer-row .icon-btn,
  .composer-row .emoji-btn {
    width: 42px;
    height: 42px;
    border-radius: 14px;
  }

  #attachToggleBtn {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    font-size: 24px;
  }

  .image-preview-bar {
    grid-template-columns: auto 1fr auto;
  }

  #imagePreviewCancelBtn {
    grid-column: 3;
  }

  .msg-image {
    max-height: 42vh;
    max-width: 100%;
  }

  .side-menu {
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    width: 100vw;
    border-radius: 0;
    padding-top: max(12px, env(safe-area-inset-top));
  }

  .sheet {
    place-items: end stretch;
  }

  .sheet-card {
    width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 84vh;
    overflow: auto;
  }

  .toast-stack {
    left: 12px;
    right: 12px;
    width: auto;
  }

  .update-banner {
    margin: 8px 8px 0;
    align-items: flex-start;
    flex-direction: column;
  }

  .compact-grid {
    grid-template-columns: 1fr 1fr;
  }

  .settings-card-head,
  .settings-device-main {
    grid-template-columns: 1fr;
    display: grid;
  }

  .settings-hero-brand {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  .settings-hero-mark {
    width: 56px;
    height: 56px;
  }

  .profile-hero-main {
    align-items: flex-start;
  }

  .room-profile-hero {
    flex-direction: column;
  }

  .room-profile-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .room-summary-grid {
    grid-template-columns: 1fr;
  }

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

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

  .shared-grid {
    grid-template-columns: 1fr;
  }

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

  .admin-user-actions {
    grid-template-columns: 1fr 1fr;
    min-width: 0;
  }

  .context-menu {
    min-width: 240px;
  }

.context-item {
  padding: 11px 12px;
  font-size: 14px;
}

.context-menu.mobile-sheet {
  left: 12px !important;
  right: 12px !important;
  top: auto !important;
  bottom: 12px !important;
  width: auto;
  min-width: 0;
  border-radius: 18px;
  padding: 8px;
  box-shadow: 0 24px 54px rgba(14, 29, 44, 0.38);
}

.context-menu.mobile-sheet .context-item {
  min-height: 46px;
  border-radius: 12px;
}
}

@media (max-width: 640px) {
  .chat-head-main .avatar {
    width: 32px;
    height: 32px;
  }

  .chat-head-main p {
    max-width: 30vw;
  }

  .composer {
    padding: 8px 6px calc(max(10px, env(safe-area-inset-bottom)) + 2px);
  }

  .msg {
    max-width: 95%;
  }

  .messages {
    padding-bottom: 84px;
  }

  .attach-menu {
    left: 6px;
  }

  .emoji-panel {
    left: 50px;
    width: min(280px, calc(100vw - 62px));
  }
}
