:root {
      color-scheme: dark;
      --bg: #0a0f1a;
      --bg-elevated: #111827;
      --bg-soft: #151d2e;
      --bg-softer: #1b2438;
      --panel: rgba(15, 20, 32, 0.96);
      --panel-2: rgba(20, 27, 43, 0.98);
      --panel-3: rgba(255,255,255,.04);
      --line: rgba(255,255,255,.08);
      --line-strong: rgba(255,255,255,.14);
      --text: #eef2ff;
      --muted: #98a4c0;
      --muted-2: #7c89a7;
      --accent: #5b8cff;
      --accent-2: #45d0b5;
      --accent-3: #7aa7ff;
      --danger: #ff7b97;
      --warn: #ffcf7a;
      --ok: #68e3b8;
      --shadow: 0 24px 70px rgba(0,0,0,.38);
      --shadow-lg: 0 30px 80px rgba(0,0,0,.45);
      --radius: 18px;
      --radius-sm: 12px;
      --chat-roundness: 18px;
      --chat-roundness-sm: 12px;
      --chat-roundness-lg: 22px;
      --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      --header-h: 52px;
      --chat-viewport-height: 100vh;
      --chat-shell-height: var(--chat-viewport-height, 100vh);
      --chat-safe-top: env(safe-area-inset-top, 0px);
      --chat-safe-right: env(safe-area-inset-right, 0px);
      --chat-safe-bottom: env(safe-area-inset-bottom, 0px);
      --chat-safe-left: env(safe-area-inset-left, 0px);
    }
    @supports (height: 100lvh) {
      :root {
        --chat-viewport-height: 100lvh;
        --chat-shell-height: 100lvh;
      }
    }

    * { box-sizing: border-box; }
    html { width: 100%; height: 100%; min-height: 100%; overflow: hidden; }
    body { width: 100%; height: 100%; min-height: 100%; overflow: hidden; }
    body {
      margin: 0;
      font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      color: var(--text);
      background:
        radial-gradient(circle at top left, rgba(91,140,255,.18), transparent 0 24%),
        radial-gradient(circle at top right, rgba(69,208,181,.10), transparent 0 20%),
        linear-gradient(180deg, #0b1020 0%, #090d17 100%);
      overflow: hidden;
    }

    button, input, textarea, select {
      font: inherit;
      color: var(--text);
      border: 1px solid rgba(255,255,255,.10);
      background: rgba(255,255,255,.05);
      border-radius: var(--chat-roundness-sm);
      padding: 10px 12px;
      transition: border-color .16s ease, background .16s ease, transform .16s ease, box-shadow .16s ease;
    }
    button { cursor: pointer; }
    button:hover, input:focus, textarea:focus, select:focus {
      outline: none;
      border-color: rgba(122,167,255,.40);
      background: rgba(255,255,255,.08);
      box-shadow: 0 0 0 3px rgba(91,140,255,.12);
    }
    button:active { transform: translateY(1px); }
    button.primary { background: linear-gradient(180deg, rgba(91,140,255,.34), rgba(91,140,255,.20)); }
    button.secondary { background: linear-gradient(180deg, rgba(69,208,181,.16), rgba(69,208,181,.08)); }
    button.warn { background: linear-gradient(180deg, rgba(255,207,122,.16), rgba(255,207,122,.08)); }
    button.danger { background: linear-gradient(180deg, rgba(255,123,151,.18), rgba(255,123,151,.10)); border-color: rgba(255,123,151,.24); }
    button.slim { padding: 8px 10px; border-radius: max(0px, calc(var(--chat-roundness-sm) - 2px)); }
    button:disabled, input:disabled, select:disabled, textarea:disabled { opacity: .56; cursor: not-allowed; box-shadow: none; }
    input::placeholder, textarea::placeholder { color: #7e8ca8; }
    select {
      background-color: #111827;
      color: var(--text);
      color-scheme: dark;
    }
    select option {
      background-color: #111827;
      color: #f4f7fb;
    }
    textarea { resize: vertical; min-height: 54px; max-height: 220px; }
    a { color: #8ab1ff; text-decoration: none; }
    a:hover { text-decoration: underline; }

    .shell {
      position: fixed;
      inset: 0;
      width: 100vw;
      height: var(--chat-shell-height, var(--chat-viewport-height, 100vh));
      min-height: var(--chat-shell-height, var(--chat-viewport-height, 100vh));
      max-height: var(--chat-shell-height, var(--chat-viewport-height, 100vh));
      display: grid;
      grid-template-rows: auto minmax(0, 1fr);
      gap: 12px;
      padding: max(12px, var(--chat-safe-top)) max(12px, var(--chat-safe-right)) max(12px, var(--chat-safe-bottom)) max(12px, var(--chat-safe-left));
      overflow: hidden;
      contain: size layout paint;
    }

    .topbar,
    .rail,
    .sidebar,
    .chat-pane,
    .detail-pane,
    .card {
      background:
        radial-gradient(circle at top left, rgba(91,140,255,.10), transparent 0 34%),
        linear-gradient(180deg, rgba(16,22,37,.96), rgba(10,15,26,.98));
      border: 1px solid var(--line);
      box-shadow: var(--shadow);
      backdrop-filter: blur(18px);
    }

    .topbar {
      min-height: var(--header-h);
      border-radius: var(--chat-roundness-lg);
      padding: 10px 12px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      position: relative;
      overflow-x: auto;
      overflow-y: hidden;
    }
    .topbar::before {
      content: "";
      position: absolute;
      inset: 0 0 auto 0;
      height: 1px;
      background: linear-gradient(90deg, transparent, rgba(122,167,255,.42), transparent);
      opacity: .7;
    }

    .row, .toolbar, .inline, .stack, .chips {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
      align-items: center;
    }
    .row.spread { justify-content: space-between; }
    .grow { flex: 1 1 auto; }

    .brand { display: flex; gap: 14px; align-items: center; min-width: 0; }
    .badge {
      width: 50px;
      height: 50px;
      border-radius: max(0px, calc(var(--chat-roundness) - 2px));
      display: grid;
      place-items: center;
      font-size: 24px;
      background:
        radial-gradient(circle at 30% 25%, rgba(255,255,255,.18), transparent 0 36%),
        linear-gradient(135deg, rgba(91,140,255,.42), rgba(69,208,181,.22));
      border: 1px solid rgba(255,255,255,.10);
      box-shadow: inset 0 1px 0 rgba(255,255,255,.10), 0 16px 30px rgba(0,0,0,.22);
    }
    .brand-copy { min-width: 0; display: grid; gap: 4px; }
    .brand h1 { margin: 0; font-size: clamp(1.15rem, 1vw + 1rem, 1.65rem); letter-spacing: -.02em; }
    .subtitle, .muted, .helper, .tiny { color: var(--muted); }
    .subtitle { font-size: 13px; }
    .tiny { font-size: 12px; }
    .mono { font-family: var(--mono); }

    .toolbar {
      justify-content: flex-start;
    }
    .topbar-status {
      margin-left: auto;
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 8px;
      flex-wrap: nowrap;
      min-width: max-content;
    }
    .toolbar .pill, .toolbar button.pill {
      background: rgba(255,255,255,.04);
    }

    .pill {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      min-height: 36px;
      padding: 8px 12px;
      border-radius: 999px;
      border: 1px solid var(--line);
      background: rgba(255,255,255,.04);
      white-space: nowrap;
    }
    .pill strong { font-weight: 700; }

    .workspace {
      min-height: 0;
      height: 100%;
      display: grid;
      grid-template-columns: 76px 320px minmax(0, 1fr) 340px;
      grid-template-rows: minmax(0, 1fr);
      gap: 12px;
      overflow: hidden;
    }

    .sidebar-toggle-btn {
      width: 36px;
      height: 36px;
      border-radius: 999px;
      display: inline-grid;
      place-items: center;
      padding: 0;
      flex: 0 0 auto;
      font-size: 20px;
      font-weight: 900;
      line-height: 1;
      background: rgba(255,255,255,.06);
      border-color: rgba(255,255,255,.12);
      box-shadow: 0 10px 30px rgba(0,0,0,.22);
      transition: transform .26s ease, opacity .26s ease, background .2s ease, border-color .2s ease, left .26s ease;
    }
    .sidebar-toggle-btn:hover {
      transform: translateY(-1px);
      background: rgba(255,255,255,.10);
      border-color: rgba(255,255,255,.18);
    }
    .floating-sidebar-toggle {
      position: fixed;
      left: 16px;
      top: 50%;
      z-index: 120;
      opacity: 0;
      pointer-events: none;
      transform: translate(-18px, -50%) scale(.92);
    }
    body.chat-sidebar-collapsed .floating-sidebar-toggle {
      opacity: 1;
      pointer-events: auto;
      transform: translate(0, -50%) scale(1);
    }
    body.chat-sidebar-collapsed .workspace {
      grid-template-columns: 0 0 minmax(0, 1fr) 340px;
    }
    body.chat-sidebar-collapsed .rail,
    body.chat-sidebar-collapsed .sidebar {
      opacity: 0;
      transform: translateX(-26px) scale(.97);
      pointer-events: none;
      padding-left: 0;
      padding-right: 0;
      border-width: 0;
    }
    body.chat-sidebar-collapsed .sidebar-toggle-btn:not(.floating-sidebar-toggle) {
      opacity: 0;
      pointer-events: none;
    }
    body.chat-sidebar-collapsed .chat-pane {
      transform: translateX(0);
    }
    @media (max-width: 1540px) {
      body.chat-sidebar-collapsed .workspace { grid-template-columns: 0 0 minmax(0, 1fr); }
    }
    @media (max-width: 1080px) and (min-width: 901px) {
      body.chat-sidebar-collapsed .workspace { grid-template-columns: 0 minmax(0, 1fr); }
      body.chat-sidebar-collapsed .rail,
      body.chat-sidebar-collapsed .sidebar {
        display: none;
      }
    }
    @media (max-width: 900px) {
      .sidebar-toggle-btn,
      .floating-sidebar-toggle { display: none; }
    }

    .rail, .sidebar, .chat-pane, .detail-pane {
      min-height: 0;
      height: 100%;
      overflow: hidden;
      border-radius: var(--chat-roundness-lg);
    }

    .rail {
      padding: 12px 10px;
      display: grid;
      align-content: start;
      gap: 10px;
      background:
        linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02)),
        var(--panel);
    }
    .rail-btn {
      width: 100%;
      height: 54px;
      border-radius: var(--chat-roundness);
      display: grid;
      place-items: center;
      font-size: 20px;
      background: rgba(255,255,255,.03);
      border: 1px solid transparent;
      position: relative;
      overflow: hidden;
    }
    .rail-btn::before {
      content: "";
      position: absolute;
      left: 6px;
      top: 10px;
      bottom: 10px;
      width: 4px;
      border-radius: 999px;
      background: transparent;
      transition: background .16s ease, transform .16s ease;
      transform: scaleY(.4);
    }
    .rail-btn:hover { background: rgba(255,255,255,.06); border-color: var(--line); }
    .rail-btn.active {
      background: linear-gradient(180deg, rgba(91,140,255,.22), rgba(91,140,255,.10));
      border-color: rgba(122,167,255,.30);
    }
    .rail-btn.active::before { background: var(--accent); transform: scaleY(1); }
    .rail-sep { height: 1px; background: var(--line); margin: 2px 6px; }

    .sidebar,
    .detail-pane,
    .chat-pane {
      display: grid;
      grid-template-rows: auto minmax(0, 1fr) auto;
    }
    .members-only-pane {
      grid-template-rows: 1fr;
    }
    .members-pane-section {
      min-height: 0;
      align-content: start;
    }
    #memberList {
      display: flex;
      flex-direction: column;
      gap: 5px;
      min-height: 0;
      align-items: stretch;
    }
    .members-only-pane #memberList {
      max-height: min(52vh, 440px);
      overflow-x: hidden;
      overflow-y: auto;
      overscroll-behavior: contain;
      scrollbar-gutter: stable;
      padding-right: 2px;
    }
    .member-item.compact-member {
      flex: 0 0 auto;
      min-height: 42px;
      padding: 5px 8px;
      gap: 0;
      cursor: default;
      border: 1px solid var(--line);
      transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
    }
    .member-item.compact-member.paying-customer {
      position: relative;
      overflow: hidden;
      padding-right: 16px;
    }
    .member-item.compact-member.paying-customer::after {
      content: "";
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      width: 6px;
      background: linear-gradient(180deg, #ffe27a 0%, #d8a51e 48%, #fff0a3 100%);
      box-shadow: inset 1px 0 0 rgba(255,255,255,.55), -1px 0 5px rgba(216,165,30,.28);
      pointer-events: none;
    }
    .member-item.compact-member.in-room {
      background: rgba(34, 197, 94, .16);
      border-color: rgba(34, 197, 94, .55);
      box-shadow: inset 3px 0 0 rgba(34, 197, 94, .85);
    }
    .member-item.compact-member.in-room .name {
      color: #bbf7d0;
    }
    .member-item.compact-member.recently-left-room {
      background: rgba(249, 115, 22, .16);
      border-color: rgba(249, 115, 22, .55);
      box-shadow: inset 3px 0 0 rgba(249, 115, 22, .85);
    }
    .member-item.compact-member.recently-left-room .name {
      color: #fed7aa;
    }
    .member-item.compact-member.away-from-room {
      background: rgba(239, 68, 68, .14);
      border-color: rgba(239, 68, 68, .52);
      box-shadow: inset 3px 0 0 rgba(239, 68, 68, .82);
    }
    .member-item.compact-member.away-from-room .name {
      color: #fecaca;
    }
    .member-item.compact-member .last-room-line {
      white-space: nowrap;
      -webkit-line-clamp: 1;
    }
    .member-item.compact-member .person {
      gap: 8px;
      min-height: 30px;
    }
    .member-item.compact-member .avatar {
      width: 32px;
      height: 32px;
      border-radius: 11px;
    }
    .member-item.compact-member .name-block {
      gap: 1px;
    }
    .member-item.compact-member .name-line {
      justify-content: flex-start;
      gap: 6px;
      flex-wrap: nowrap;
      min-height: 17px;
    }
    .member-item.compact-member .name {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-size: 12.5px;
      line-height: 1.15;
    }
    .member-item.compact-member .subline {
      font-size: 10.5px;
      line-height: 1.2;
    }
    .member-item.compact-member .pill.tiny {
      flex: 0 0 auto;
      max-width: 132px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .presence-pill {
      cursor: pointer;
      appearance: none;
    }

    .sidebar-head,
    .detail-head,
    .chat-head,
    .composer {
      padding: 14px 16px;
      border-bottom: 1px solid var(--line);
      background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.02));
    }
    .sidebar-head,
    .detail-head,
    .chat-head {
      background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.025));
      box-shadow: inset 0 -1px 0 rgba(255,255,255,.03);
    }
    .composer {
      border-top: 1px solid var(--line);
      border-bottom: 0;
      background: linear-gradient(180deg, rgba(14,18,28,.94), rgba(11,16,24,.98));
    }
    .sidebar-body,
    .detail-body,
    .chat-body {
      min-height: 0;
      overflow: auto;
      padding: 14px;
      display: grid;
      gap: 14px;
      align-content: start;
    }
    .sidebar-body,
    .detail-body {
      background: linear-gradient(180deg, rgba(255,255,255,.025), rgba(255,255,255,.01));
    }

    .section {
      display: grid;
      gap: 10px;
      padding-bottom: 2px;
    }
    .section-title {
      color: var(--muted-2);
      font-size: 11px;
      letter-spacing: .12em;
      text-transform: uppercase;
      font-weight: 800;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding: 0 2px;
    }

    .nav-item, .friend-item, .member-item, .search-user, .blocked-item {
      border: 1px solid transparent;
      border-radius: 14px;
      background: rgba(255,255,255,.035);
      padding: 10px 12px;
      display: grid;
      gap: 10px;
      text-align: left;
      width: 100%;
      box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
    }
    .nav-item.compact-conversation {
      padding: 8px 10px;
      gap: 4px;
    }
    .nav-item.compact-conversation .name-line {
      justify-content: space-between;
    }
    .nav-time-value {
      flex: 0 0 auto;
      color: var(--muted);
      font-size: 11px;
      font-weight: 700;
      margin-left: 8px;
      white-space: nowrap;
    }
    .nav-item.room-colored .nav-time-value,
    .nav-item.room-colored .unread-badge {
      color: inherit;
    }
    .nav-item.room-colored:hover {
      filter: brightness(1.08);
    }
    .room-color-editor {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
      padding: 10px 12px;
      border: 1px solid rgba(255,255,255,.08);
      border-radius: 14px;
      background: rgba(255,255,255,.035);
    }
    .room-color-editor input[type="color"] {
      width: 52px;
      min-width: 52px;
      height: 40px;
      padding: 3px;
    }
    .nav-item:hover, .friend-item:hover, .member-item:hover, .search-user:hover, .blocked-item:hover {
      background: rgba(255,255,255,.055);
      border-color: rgba(255,255,255,.07);
    }
    .nav-item.active {
      background: linear-gradient(180deg, rgba(91,140,255,.18), rgba(91,140,255,.08));
      border-color: rgba(122,167,255,.28);
      box-shadow: inset 0 0 0 1px rgba(122,167,255,.16);
    }
    .nav-item[role="button"] { cursor: pointer; }
    .nav-row-shell {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      align-items: center;
      gap: 8px;
    }
    .room-reorder-handle {
      display: inline-flex;
      align-items: center;
      gap: 3px;
      padding-left: 6px;
      color: var(--muted-2);
      cursor: grab;
    }
    .room-reorder-grip {
      font-weight: 900;
      letter-spacing: -2px;
      opacity: .9;
      transform: rotate(90deg);
      user-select: none;
    }
    .room-reorder-control {
      width: 24px;
      min-width: 24px;
      height: 24px;
      padding: 0;
      border-radius: 8px;
      font-size: 12px;
      line-height: 1;
      display: inline-grid;
      place-items: center;
      background: rgba(255,255,255,.08);
      border: 1px solid rgba(255,255,255,.10);
      color: inherit;
    }
    .room-reorder-control:hover:not(:disabled) {
      background: rgba(255,255,255,.14);
      box-shadow: none;
    }
    .room-reorder-control:disabled {
      opacity: .35;
      cursor: not-allowed;
    }
    .room-access-panel {
      display: grid;
      gap: 12px;
      padding: 12px;
      border: 1px solid rgba(255,255,255,.08);
      border-radius: 16px;
      background: rgba(255,255,255,.03);
    }
    .room-access-list {
      display: grid;
      gap: 8px;
    }
    .room-access-user {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      align-items: center;
      gap: 10px;
      padding: 9px 10px;
      border: 1px solid rgba(255,255,255,.07);
      border-radius: 12px;
      background: rgba(255,255,255,.035);
    }
    .room-access-user .name-block { min-width: 0; }

    .person {
      display: flex;
      align-items: center;
      gap: 10px;
      min-width: 0;
    }
    .avatar {
      width: 40px;
      height: 40px;
      border-radius: 14px;
      flex: 0 0 auto;
      object-fit: cover;
      display: grid;
      place-items: center;
      font-weight: 800;
      background: linear-gradient(135deg, rgba(91,140,255,.28), rgba(69,208,181,.20));
      border: 1px solid rgba(255,255,255,.10);
      overflow: hidden;
    }
    .avatar.small {
      width: 42px;
      height: 42px;
      border-radius: 14px;
    }
    .name-block {
      min-width: 0;
      display: grid;
      gap: 3px;
    }
    .name-line {
      display: flex;
      align-items: center;
      gap: 8px;
      min-width: 0;
    }
    .name {
      font-weight: 700;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .subline {
      color: var(--muted);
      font-size: 12px;
      line-height: 1.4;
      overflow: hidden;
      text-overflow: ellipsis;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
    }

    .status-dot {
      width: 10px;
      height: 10px;
      border-radius: 50%;
      flex: 0 0 auto;
      border: 2px solid rgba(12,15,24,.9);
      box-shadow: 0 0 0 1px rgba(255,255,255,.08);
    }
    .status-online { background: #56e6b3; }
    .status-idle { background: #ffcf78; }
    .status-dnd { background: #ff7993; }
    .status-offline { background: #7b88a5; }

    .chat-head {
      padding: 16px 18px;
      position: relative;
    }
    .chat-head::after {
      content: "";
      position: absolute;
      inset: auto 0 0 0;
      height: 1px;
      background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent);
    }
    .chat-title-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }
    .chat-title-main {
      min-width: 0;
      display: flex;
      align-items: center;
      gap: 12px;
    }
    .chat-glyph {
      width: 40px;
      height: 40px;
      border-radius: 14px;
      display: grid;
      place-items: center;
      background: rgba(255,255,255,.05);
      border: 1px solid var(--line);
      color: var(--accent-3);
      font-weight: 800;
      font-size: 18px;
      flex: 0 0 auto;
      overflow: hidden;
    }
    .chat-glyph.has-image {
      padding: 0;
      background: rgba(0,0,0,.24);
    }
    .chat-glyph img {
      width: 100%;
      height: 100%;
      display: block;
      object-fit: cover;
      border-radius: inherit;
    }
    .chat-title-copy { min-width: 0; display: grid; gap: 4px; }

    .chat-body {
      padding: 16px 18px 20px;
      gap: 12px;
      background:
        radial-gradient(circle at 18% 0%, rgba(91,140,255,.06), transparent 0 24%),
        linear-gradient(180deg, rgba(255,255,255,.025), rgba(255,255,255,.01));
      scroll-behavior: smooth;
    }

    .day-divider {
      position: sticky;
      top: -2px;
      z-index: 2;
      text-align: center;
      color: var(--muted);
      font-size: 11px;
      font-weight: 700;
      letter-spacing: .08em;
      text-transform: uppercase;
      padding: 10px 0 6px;
      background: linear-gradient(180deg, rgba(17,23,35,.96), rgba(17,23,35,.72));
    }

    .message {
      position: relative;
      display: grid;
      grid-template-columns: auto minmax(0, 1fr) auto;
      gap: 10px;
      padding: 6px 8px;
      margin: 0;
      border-radius: var(--chat-roundness-sm);
      background: transparent;
      border: 1px solid transparent;
      align-items: start;
      transition: background .14s ease, border-color .14s ease;
      box-shadow: none;
    }
    .message:hover {
      background: rgba(255,255,255,.035);
      border-color: transparent;
      transform: none;
    }
    .message.context-open {
      background: rgba(91,140,255,.08);
      border-color: rgba(122,167,255,.16);
      box-shadow: inset 3px 0 0 rgba(122,167,255,.45);
    }
    .message.mine {
      background: transparent;
      border-color: transparent;
    }
    .message.pending {
      opacity: .72;
    }
    .message.failed {
      opacity: .9;
      border-color: rgba(255, 107, 107, .32);
      background: rgba(255, 107, 107, .08);
    }
    .message.reaction-glow {
      animation: reactionGlowPulse 1.6s ease-out;
    }
    @keyframes reactionGlowPulse {
      0% {
        border-color: rgba(255, 213, 107, .82);
        box-shadow: 0 0 0 0 rgba(255, 213, 107, .42), 0 0 24px rgba(255, 213, 107, .26);
        background: rgba(255, 213, 107, .12);
      }
      62% {
        border-color: rgba(255, 213, 107, .42);
        box-shadow: 0 0 0 8px rgba(255, 213, 107, .06), 0 0 18px rgba(255, 213, 107, .12);
        background: rgba(255, 213, 107, .055);
      }
      100% {
        border-color: transparent;
        box-shadow: none;
        background: transparent;
      }
    }
    .message.action-message {
      display: block;
      padding: 5px 12px;
      color: var(--muted);
      font-size: 13px;
      font-style: italic;
      text-align: center;
    }
    .message.action-message:hover {
      background: rgba(255,255,255,.025);
    }
    .message-action-text {
      display: inline-block;
      max-width: 100%;
      overflow-wrap: anywhere;
    }
    .message.action-message .message-hover-actions {
      right: 16px;
    }
    .message.action-message .message-ref,
    .message.action-message .attachment-grid,
    .message.action-message .link-preview-list,
    .message.action-message .message-reactions {
      max-width: min(760px, 100%);
      margin-left: auto;
      margin-right: auto;
      text-align: left;
    }
    .message-action-content {
      display: block;
    }
    .message-send-state {
      color: var(--muted);
      font-size: 11px;
      font-weight: 700;
    }
    .message.failed .message-send-state {
      color: #ffb4b4;
    }
    .message-body {
      min-width: 0;
      padding-top: 1px;
      display: grid;
      gap: 2px;
    }
    .message-hover-actions {
      position: absolute;
      top: -12px;
      right: 52px;
      z-index: 5;
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 5px;
      border-radius: 999px;
      border: 1px solid rgba(255,255,255,.12);
      background: linear-gradient(180deg, rgba(23,30,44,.98), rgba(13,18,30,.98));
      box-shadow: 0 12px 30px rgba(0,0,0,.30);
      opacity: 0;
      transform: translateY(2px);
      pointer-events: none;
      transition: opacity .12s ease, transform .12s ease;
    }
    .message:hover .message-hover-actions,
    .message:focus-within .message-hover-actions,
    .message.context-open .message-hover-actions {
      opacity: 1;
      transform: translateY(0);
      pointer-events: auto;
    }
    /* Keep quick reactions clear of room read-receipt circles so their hover labels remain reachable. */
    .message:not(.action-message):has(> .message-receipts.room-receipt-row > .receipt-dot) .message-hover-actions {
      right: 148px;
    }
    .message-tool-btn {
      min-height: 30px;
      min-width: 30px;
      padding: 5px 8px;
      border-radius: 999px;
      border: 1px solid transparent;
      background: transparent;
      color: var(--text);
      box-shadow: none;
      font-weight: 800;
      line-height: 1;
    }
    .message-tool-btn:hover {
      background: rgba(255,255,255,.08);
      border-color: rgba(255,255,255,.12);
      transform: none;
    }
    .message-tool-reply {
      min-width: auto;
      padding-inline: 10px;
      font-size: 12px;
    }
    .emoji-reaction-grid {
      display: grid;
      grid-template-columns: repeat(8, minmax(0, 1fr));
      gap: 4px;
      max-width: 292px;
    }
    .emoji-reaction-grid .context-menu-btn {
      min-height: 34px;
      justify-content: center;
      padding: 6px;
      font-size: 18px;
    }
    .message-reactions {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
      margin-top: 8px;
    }
    .reaction-chip {
      position: relative;
      display: inline-flex;
      align-items: center;
      gap: 5px;
      min-height: 28px;
      padding: 4px 8px;
      border-radius: 999px;
      border: 1px solid rgba(255,255,255,.10);
      background: rgba(255,255,255,.045);
      color: var(--text);
      font-size: 13px;
      box-shadow: none;
    }
    .reaction-chip[data-reaction-tooltip]:hover::after,
    .reaction-chip[data-reaction-tooltip]:focus-visible::after {
      content: attr(data-reaction-tooltip);
      position: absolute;
      left: 50%;
      bottom: calc(100% + 8px);
      transform: translateX(-50%);
      z-index: 120;
      width: max-content;
      max-width: min(320px, 72vw);
      padding: 7px 9px;
      border-radius: 10px;
      border: 1px solid rgba(255,255,255,.14);
      background: rgba(18,22,34,.96);
      color: var(--text);
      font-size: 12px;
      font-weight: 600;
      line-height: 1.35;
      text-align: center;
      white-space: normal;
      overflow-wrap: anywhere;
      box-shadow: 0 12px 28px rgba(0,0,0,.32);
      pointer-events: none;
    }
    .reaction-chip[data-reaction-tooltip]:hover::before,
    .reaction-chip[data-reaction-tooltip]:focus-visible::before {
      content: '';
      position: absolute;
      left: 50%;
      bottom: calc(100% + 3px);
      transform: translateX(-50%) rotate(45deg);
      z-index: 119;
      width: 10px;
      height: 10px;
      background: rgba(18,22,34,.96);
      border-right: 1px solid rgba(255,255,255,.14);
      border-bottom: 1px solid rgba(255,255,255,.14);
      pointer-events: none;
    }
    .reaction-chip.mine {
      border-color: rgba(140,236,160,.34);
      background: rgba(88,199,111,.13);
    }
    .reaction-chip:hover {
      background: rgba(255,255,255,.075);
      transform: none;
    }
    .mic-recording {
      border-color: rgba(255, 107, 107, .42) !important;
      background: rgba(255, 107, 107, .13) !important;
      color: #ffd7d7 !important;
      animation: micRecordingPulse 1.1s ease-in-out infinite;
    }
    @keyframes micRecordingPulse {
      0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, .22); }
      50% { box-shadow: 0 0 0 6px rgba(255, 107, 107, .06); }
    }
    .message-head {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      margin-top: 2px;
    }
    .message-time { color: var(--muted-2); font-size: 12px; }
    .receipt-author-dot, .receipt-dot {
      width: 10px;
      height: 10px;
      border-radius: 999px;
      display: inline-block;
      flex: 0 0 auto;
      background: var(--receipt-color, #9fb0c8);
      border: 1px solid rgba(255,255,255,.58);
      box-shadow: 0 0 0 2px rgba(255,255,255,.04);
    }
    .receipt-author-dot {
      margin-left: -2px;
      transform: translateY(1px);
    }
    .message-receipts {
      position: relative;
      z-index: 6;
      align-self: start;
      display: flex;
      justify-content: flex-end;
      gap: 5px;
      min-width: 20px;
      max-width: 132px;
      padding-top: 14px;
    }
    .room-receipt-row {
      flex-wrap: wrap;
    }
    .receipt-dot {
      cursor: help;
    }
    .receipt-dot.seen {
      opacity: 1;
    }
    .receipt-dot.pending {
      opacity: .34;
      filter: grayscale(1) saturate(.35);
      border-style: dashed;
      box-shadow: none;
    }
    .receipt-dot.receipt-avatar {
      object-fit: cover;
      display: inline-block;
      overflow: hidden;
      vertical-align: middle;
      background: rgba(255,255,255,.06);
    }
    .receipt-dot.dm {
      width: 11px;
      height: 11px;
      background: #667085;
      border-color: rgba(255,255,255,.36);
      opacity: .92;
    }
    .receipt-dot.dm.seen {
      background: #4d8dff;
      border-color: rgba(183,210,255,.78);
      box-shadow: 0 0 0 3px rgba(77,141,255,.16);
    }
    .message-content {
      white-space: pre-wrap;
      word-break: break-word;
      line-height: 1.6;
      margin-top: 5px;
      color: #edf2ff;
    }
    .message-link {
      color: #9cc4ff;
      font-weight: 700;
      text-decoration: none;
      border-bottom: 1px solid rgba(156, 196, 255, .45);
    }
    .message-link:hover {
      color: #c8dcff;
      border-bottom-color: rgba(200, 220, 255, .8);
    }
    .link-preview-list {
      display: grid;
      gap: 12px;
      margin-top: 10px;
      max-width: min(100%, 546px);
    }
    .link-preview-card {
      display: grid;
      grid-template-columns: minmax(0, 1fr);
      overflow: hidden;
      border: 1px solid rgba(255,255,255,.14);
      border-radius: 16px;
      background: rgba(255,255,255,.045);
      color: var(--text);
      text-decoration: none;
      box-shadow: 0 16px 42px rgba(0,0,0,.24);
      transition: transform .16s ease, border-color .16s ease, background .16s ease;
    }
    .link-preview-card:hover {
      transform: translateY(-1px);
      border-color: rgba(156, 196, 255, .42);
      background: rgba(255,255,255,.07);
    }
    .link-preview-card.has-image {
      grid-template-rows: auto auto;
      background: rgba(8,13,22,.78);
    }
    .link-preview-media {
      width: 100%;
      aspect-ratio: 16 / 9;
      min-height: 154px;
      max-height: 301px;
      background: rgba(255,255,255,.06);
      overflow: hidden;
    }
    .link-preview-image,
    .link-preview-embed iframe,
    .link-preview-youtube iframe {
      display: block;
      width: 100%;
      height: 100%;
      background: rgba(255,255,255,.06);
    }
    .link-preview-image {
      object-fit: cover;
    }
    .link-preview-embed iframe,
    .link-preview-youtube iframe {
      border: 0;
    }
    .link-preview-youtube {
      position: relative;
      display: grid;
      place-items: stretch;
    }
    .youtube-preview-button {
      position: relative;
      display: block;
      width: 100%;
      height: 100%;
      padding: 0;
      border: 0;
      cursor: pointer;
      color: var(--text);
      background: rgba(0,0,0,.18);
    }
    .youtube-preview-button:hover .youtube-preview-thumb {
      filter: brightness(1.08);
      transform: scale(1.015);
    }
    .youtube-preview-thumb {
      display: block;
      width: 100%;
      height: 100%;
      object-fit: cover;
      transition: transform .18s ease, filter .18s ease;
    }
    .youtube-play-badge {
      position: absolute;
      inset: 50% auto auto 50%;
      transform: translate(-50%, -50%);
      display: inline-grid;
      place-items: center;
      width: 68px;
      height: 48px;
      border-radius: 16px;
      color: #fff;
      background: rgba(0,0,0,.72);
      box-shadow: 0 14px 34px rgba(0,0,0,.35);
      font-size: 26px;
      line-height: 1;
    }
    .youtube-preview-button:hover .youtube-play-badge {
      background: rgba(255,0,0,.86);
    }
    .youtube-fallback-row {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 8px;
      margin-top: 3px;
      color: var(--muted);
      font-size: 12px;
    }
    .youtube-fallback-link {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 28px;
      padding: 5px 10px;
      border: 1px solid rgba(156,196,255,.32);
      border-radius: 999px;
      color: #c8dcff;
      font-weight: 800;
      text-decoration: none;
      background: rgba(156,196,255,.10);
    }
    .youtube-fallback-link:hover {
      border-color: rgba(156,196,255,.58);
      background: rgba(156,196,255,.18);
    }
    .link-preview-body {
      min-width: 0;
      display: grid;
      gap: 5px;
      align-content: start;
      padding: 12px 14px;
    }
    .link-preview-card.has-image .link-preview-body {
      background: linear-gradient(180deg, rgba(9,14,24,.98), rgba(12,18,30,.94));
      border-top: 1px solid rgba(255,255,255,.10);
      padding: 13px 16px 15px;
    }
    .link-preview-site,
    .link-preview-url {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      color: var(--muted);
      font-size: 12px;
    }
    a.link-preview-url {
      text-decoration: none;
    }
    a.link-preview-url:hover {
      color: #c8dcff;
    }
    .link-preview-title {
      min-width: 0;
      color: var(--text);
      font-size: 14px;
      font-weight: 800;
      line-height: 1.35;
    }
    .link-preview-card.has-image .link-preview-title {
      font-size: 16px;
    }
    .link-preview-description {
      color: #cfd6e6;
      font-size: 13px;
      line-height: 1.35;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }
    .link-preview-card.loading .link-preview-title,
    .link-preview-card.unavailable .link-preview-title {
      color: var(--muted);
      font-weight: 700;
    }
    @media (max-width: 640px) {
      .link-preview-list {
        max-width: 100%;
      }
      .link-preview-media {
        min-height: 119px;
      }
      .link-preview-card.has-image .link-preview-title {
        font-size: 15px;
      }
    }

    .attachment-grid {
      display: grid;
      gap: 10px;
      justify-items: start;
      margin-top: 12px;
    }
    .attachment-card {
      display: grid;
      gap: 8px;
      justify-items: start;
      width: auto;
      max-width: min(100%, 760px);
      padding: 0;
      border: 0;
      border-radius: 0;
      background: transparent;
      box-shadow: none;
    }
    .attachment-card img, .attachment-card video {
      display: block;
      width: auto;
      max-width: min(100%, 760px);
      max-height: min(72vh, 520px);
      object-fit: contain;
      border-radius: 12px;
      background: transparent;
    }
    .attachment-card img {
      cursor: zoom-in;
    }
    .attachment-card video {
      width: min(100%, 760px);
    }
    .attachment-card video,
    .content-gallery-item video,
    video[data-inline-media="true"] {
      background: #000;
    }
    .attachment-card video.ldb-safari-video,
    .content-gallery-item video.ldb-safari-video,
    video[data-inline-media="true"].ldb-safari-video {
      -webkit-transform: translateZ(0);
      transform: translateZ(0);
      -webkit-backface-visibility: hidden;
      backface-visibility: hidden;
      will-change: transform, opacity;
    }
    .video-safari-fallback {
      display: grid;
      gap: 8px;
      max-width: min(100%, 760px);
      margin-top: 8px;
      padding: 10px 12px;
      border: 1px solid rgba(251,191,36,.36);
      border-radius: 12px;
      background: rgba(251,191,36,.10);
      color: var(--text);
      font-size: 13px;
      line-height: 1.35;
    }
    .video-safari-fallback-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }
    .video-safari-fallback-actions a,
    .video-safari-fallback-actions button {
      appearance: none;
      border: 1px solid rgba(255,255,255,.16);
      border-radius: 999px;
      padding: 6px 10px;
      background: rgba(255,255,255,.08);
      color: var(--text);
      text-decoration: none;
      font-size: 12px;
      cursor: pointer;
    }
    .video-thumbnail {
      position: relative;
      display: block;
      width: min(100%, 760px);
      min-height: 180px;
      max-height: min(72vh, 520px);
      padding: 0;
      overflow: hidden;
      border: 0;
      border-radius: 12px;
      background: rgba(2,6,23,.78);
      cursor: pointer;
    }
    .video-thumbnail img {
      display: block;
      width: 100%;
      height: auto;
      max-height: min(72vh, 520px);
      object-fit: contain;
      cursor: pointer;
    }
    .video-thumbnail.loading::before {
      content: 'Loading preview…';
      position: absolute;
      inset: 0;
      display: grid;
      place-items: center;
      color: var(--muted);
      font-size: 13px;
    }
    .video-thumbnail-play {
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      width: 70px;
      height: 70px;
      border-radius: 999px;
      background: rgba(0,0,0,.48);
      box-shadow: 0 12px 32px rgba(0,0,0,.34);
    }
    .video-thumbnail-play::after {
      content: '';
      position: absolute;
      left: 28px;
      top: 21px;
      width: 0;
      height: 0;
      border-top: 14px solid transparent;
      border-bottom: 14px solid transparent;
      border-left: 20px solid rgba(255,255,255,.88);
    }
    .attachment-card.attachment-audio,
    .attachment-card.attachment-voice {
      justify-self: stretch;
      width: min(100%, 560px);
      min-width: min(320px, 100%);
      padding: 12px 14px;
      border: 1px solid rgba(255,255,255,.12);
      border-radius: 16px;
      background: rgba(255,255,255,.045);
    }
    .attachment-card.attachment-audio audio,
    .attachment-card.attachment-voice audio {
      display: block;
      width: 100%;
      min-width: min(100%, 280px);
      max-width: 100%;
      height: 42px;
      border-radius: 999px;
    }
    .voice-message-label {
      color: var(--text);
      font-size: 12px;
      font-weight: 900;
      letter-spacing: .01em;
    }

    .attachment-meta {
      display: flex;
      justify-content: flex-start;
      gap: 12px;
      color: var(--muted);
      font-size: 12px;
      flex-wrap: wrap;
    }
    .attachment-link {
      color: #9fc0ff;
      font-weight: 700;
      overflow-wrap: anywhere;
      display: inline-block;
    }

    .conversation-content-section {
      min-height: 0;
      display: grid;
      gap: 10px;
    }
    .conversation-content-section .section-title { align-items: center; }
    .content-section-subtitle {
      color: var(--muted-2);
      font-size: 11px;
      letter-spacing: 0;
      text-transform: none;
      font-weight: 700;
      white-space: nowrap;
    }
    .content-browser-tabs {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 6px;
    }
    .content-browser-tab {
      min-width: 0;
      padding: 7px 8px;
      border-radius: 11px;
      font-size: 11px;
      font-weight: 800;
      color: var(--muted);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 6px;
      background: rgba(255,255,255,.035);
    }
    .content-browser-tab.active {
      color: #eef5ff;
      border-color: rgba(122,167,255,.34);
      background: linear-gradient(180deg, rgba(91,140,255,.22), rgba(91,140,255,.10));
      box-shadow: 0 0 0 3px rgba(91,140,255,.08);
    }
    .content-browser-count {
      color: var(--muted-2);
      font-size: 10px;
      font-weight: 900;
      padding: 1px 5px;
      border-radius: 999px;
      background: rgba(255,255,255,.07);
    }
    .content-browser-body {
      min-height: 96px;
      max-height: min(46vh, 430px);
      overflow: auto;
      padding-right: 2px;
    }
    .content-gallery-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 7px;
    }
    .content-gallery-item {
      position: relative;
      display: block;
      aspect-ratio: 1;
      overflow: hidden;
      border-radius: 13px;
      border: 1px solid rgba(255,255,255,.10);
      background: rgba(255,255,255,.045);
      box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
    }
    .content-gallery-item:hover {
      border-color: rgba(122,167,255,.42);
      transform: translateY(-1px);
      box-shadow: 0 12px 28px rgba(0,0,0,.24);
      text-decoration: none;
    }
    .content-gallery-item img,
    .content-gallery-item video {
      display: block;
      width: 100%;
      height: 100%;
      object-fit: cover;
      background: rgba(2,6,23,.62);
    }
    .content-gallery-play {
      position: absolute;
      inset: auto 7px 7px auto;
      width: 28px;
      height: 28px;
      border-radius: 999px;
      display: grid;
      place-items: center;
      color: #fff;
      background: rgba(0,0,0,.52);
      box-shadow: 0 6px 18px rgba(0,0,0,.28);
      font-size: 12px;
      pointer-events: none;
    }
    .content-list { display: grid; gap: 8px; }
    .content-list-item {
      display: grid;
      gap: 4px;
      padding: 9px 10px;
      border-radius: 13px;
      border: 1px solid rgba(255,255,255,.10);
      background: rgba(255,255,255,.04);
      color: var(--text);
      text-decoration: none;
      min-width: 0;
    }
    .content-list-item:hover {
      border-color: rgba(122,167,255,.38);
      background: rgba(255,255,255,.065);
      text-decoration: none;
    }
    .content-list-title {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-weight: 800;
      font-size: 12px;
    }
    .content-list-meta {
      color: var(--muted-2);
      font-size: 11px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .content-voice-item {
      display: grid;
      gap: 8px;
    }
    .content-voice-item audio {
      width: 100%;
      min-width: 0;
      height: 38px;
    }
    .content-browser-empty {
      display: grid;
      place-items: center;
      min-height: 92px;
      padding: 14px;
      border: 1px dashed rgba(255,255,255,.12);
      border-radius: 14px;
      color: var(--muted);
      text-align: center;
      font-size: 12px;
      line-height: 1.4;
      background: rgba(255,255,255,.025);
    }
    .content-browser-retry {
      justify-self: start;
      margin-top: 8px;
      padding: 7px 9px;
      font-size: 11px;
    }

    .gif-picker {
      position: fixed;
      right: 20px;
      bottom: 92px;
      z-index: 1600;
      display: grid;
      gap: 10px;
      width: min(calc(100vw - 40px), 760px);
      max-height: min(78vh, 720px);
      padding: 14px;
      border: 1px solid rgba(255,255,255,.16);
      border-radius: 18px;
      background: rgba(11,16,32,.98);
      box-shadow: 0 22px 70px rgba(0,0,0,.52);
    }
    .gif-picker[hidden] {
      display: none;
    }
    .gif-picker-head {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }
    .gif-picker-head input {
      min-width: min(100%, 220px);
      flex: 1;
    }
    .gif-picker-status {
      color: var(--muted);
      font-size: 12px;
    }
    .gif-picker-status.bad {
      color: #ffb4b4;
    }
    .gif-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
      gap: 8px;
      max-height: min(58vh, 540px);
      overflow: auto;
      padding-right: 4px;
    }
    .gif-result {
      display: grid;
      gap: 6px;
      padding: 6px;
      border: 1px solid rgba(255,255,255,.10);
      border-radius: 14px;
      background: rgba(255,255,255,.055);
      color: var(--text);
      text-align: left;
      cursor: pointer;
    }
    .gif-result:hover, .gif-result:focus-visible {
      border-color: rgba(112,162,255,.55);
      background: rgba(112,162,255,.16);
    }
    .gif-result img {
      width: 100%;
      aspect-ratio: 1 / 1;
      object-fit: cover;
      border-radius: 10px;
      background: rgba(255,255,255,.06);
    }
    .gif-result span {
      display: none;
    }
    @media (max-width: 720px) {
      .gif-picker {
        right: 10px;
        bottom: 82px;
        width: calc(100vw - 20px);
        max-height: 74vh;
      }
      .gif-grid {
        grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
      }
    }

    .composer-grid {
      display: grid;
      gap: 10px;
    }
    .composer textarea {
      min-height: 62px;
      border-radius: 14px;
      background: rgba(255,255,255,.05);
      padding: 14px 14px;
    }
    .composer textarea.drag-over {
      border-color: rgba(122,167,255,.55);
      background: rgba(91,140,255,.12);
      box-shadow: 0 0 0 3px rgba(91,140,255,.12);
    }
    .composer-editor {
      min-height: 62px;
      max-height: 220px;
      overflow: auto;
      border-radius: 14px;
      background: rgba(255,255,255,.05);
      padding: 14px 14px;
      white-space: pre-wrap;
      word-break: break-word;
      outline: none;
      border: 1px solid rgba(255,255,255,.10);
    }
    .composer-editor:focus {
      border-color: rgba(122,167,255,.40);
      background: rgba(255,255,255,.08);
      box-shadow: 0 0 0 3px rgba(91,140,255,.12);
    }
    .composer-editor.drag-over {
      border-color: rgba(122,167,255,.55);
      background: rgba(91,140,255,.12);
      box-shadow: 0 0 0 3px rgba(91,140,255,.12);
    }
    .composer-editor:empty::before {
      content: attr(data-placeholder);
      color: #7e8ca8;
      pointer-events: none;
    }
    .mention {
      display: inline-flex;
      align-items: center;
      max-width: 260px;
      padding: 1px 7px;
      border-radius: 999px;
      border: 1px solid rgba(122,167,255,.32);
      background: rgba(91,140,255,.18);
      color: #cfe0ff;
      font-weight: 800;
      line-height: 1.35;
      vertical-align: baseline;
      text-decoration: none;
      cursor: pointer;
      white-space: nowrap;
    }
    .message.mine .mention {
      background: rgba(255,255,255,.18);
      border-color: rgba(255,255,255,.28);
      color: #ffffff;
    }
    .composer-editor .mention {
      background: rgba(91,140,255,.24);
      border-color: rgba(122,167,255,.42);
    }
    .mention-suggest {
      display: grid;
      gap: 6px;
      max-height: 220px;
      overflow: auto;
      padding: 8px;
      border: 1px solid rgba(122,167,255,.25);
      border-radius: 14px;
      background: rgba(14, 19, 31, .98);
      box-shadow: 0 18px 40px rgba(0,0,0,.34), inset 0 1px 0 rgba(255,255,255,.04);
    }
    .mention-suggest[hidden] { display: none !important; }
    .mention-suggest-title {
      padding: 2px 5px 4px;
      color: var(--muted);
      font-size: 11px;
      font-weight: 800;
      letter-spacing: .08em;
      text-transform: uppercase;
    }
    .mention-suggest-item {
      display: flex;
      align-items: center;
      gap: 9px;
      width: 100%;
      min-height: 40px;
      padding: 7px 9px;
      border-radius: 12px;
      border: 1px solid transparent;
      background: transparent;
      color: var(--text);
      text-align: left;
      cursor: pointer;
    }
    .mention-suggest-item:hover,
    .mention-suggest-item.active {
      border-color: rgba(122,167,255,.30);
      background: rgba(91,140,255,.14);
    }
    .mention-suggest-item .avatar {
      width: 28px;
      height: 28px;
      font-size: 11px;
    }
    .mention-suggest-item .mention-suggest-name {
      min-width: 0;
      display: grid;
      gap: 1px;
    }
    .mention-suggest-item .name {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-weight: 800;
    }
    .mention-suggest-item .subline {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-size: 11px;
      color: var(--muted);
    }
    .format-toolbar {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      padding: 8px 10px;
      border: 1px solid rgba(255,255,255,.08);
      border-radius: 14px;
      background: rgba(255,255,255,.035);
    }
    .format-toolbar[hidden] {
      display: none;
    }
    #fontToggleBtn.active {
      border-color: rgba(122,167,255,.65);
      background: rgba(91,140,255,.22);
      color: #dbe7ff;
    }
    .format-toolbar button,
    .format-toolbar select,
    .format-toolbar input[type="color"] {
      min-height: 34px;
      padding: 6px 9px;
      border-radius: 10px;
    }
    .format-toolbar select {
      color: var(--text);
      background: rgba(15, 20, 32, .98);
      border-color: rgba(255,255,255,.14);
    }
    .format-toolbar select option {
      color: var(--text);
      background: #111827;
    }
    #chatThemeSelect,
    #chatThemeSelect option {
      color: #f4f7fb;
      background-color: #111827;
    }
    .format-toolbar input[type="color"] {
      width: 42px;
      min-width: 42px;
      padding: 3px;
      background: rgba(15, 20, 32, .98);
      border-color: rgba(255,255,255,.14);
    }
    .format-save-btn {
      min-width: 58px;
      font-weight: 800;
    }
    .format-save-btn.saved {
      border-color: rgba(140,236,160,.38);
      background: rgba(88,199,111,.14);
    }
    .people-pane-tools {
      position: sticky;
      top: 0;
      z-index: 2;
      display: grid;
      gap: 8px;
      padding: 0 0 8px;
      background: linear-gradient(180deg, rgba(255,255,255,.025), rgba(255,255,255,.01));
      box-shadow: 0 8px 14px rgba(9,13,22,.10);
    }
    .people-pane-title-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
    }
    .people-pane-count {
      white-space: nowrap;
      color: var(--muted);
    }
    #peoplePaneList {
      display: grid;
      gap: 8px;
    }
    .people-pane-card {
      cursor: pointer;
      padding: 7px 9px;
      gap: 0;
      min-height: 0;
    }
    .people-pane-card .person {
      gap: 8px;
    }
    .people-pane-card .avatar {
      width: 34px;
      height: 34px;
      border-radius: 12px;
    }
    .people-pane-card .name-block {
      gap: 0;
    }
    .people-pane-card .name {
      font-size: 13px;
    }
    .people-pane-card .name-line {
      display: flex;
      align-items: center;
      gap: 6px;
      min-width: 0;
    }
    .people-pane-card .name-line .name {
      min-width: 0;
      flex: 0 1 auto;
      max-width: 100%;
    }
    .people-pane-card .people-status-dot {
      display: inline-block !important;
      opacity: 1 !important;
      visibility: visible !important;
      width: 10px;
      height: 10px;
      flex: 0 0 10px;
      margin-left: 0;
    }
    .people-pane-card .pill.tiny {
      margin-left: 0;
      padding: 2px 7px;
      font-size: 10px;
      line-height: 1.1;
      white-space: nowrap;
      max-width: 126px;
      overflow: hidden;
      text-overflow: ellipsis;
      flex: 0 1 auto;
    }
    .people-pane-card .subline {
      display: block;
      margin-top: 2px;
      white-space: nowrap;
      -webkit-line-clamp: 1;
    }
    .people-pane-card .row {
      display: none !important;
    }
    .people-pane-card.context-open {
      background: rgba(255,255,255,.07);
      border-color: rgba(122,167,255,.26);
    }
    .message-content span[style] {
      white-space: inherit;
    }
    .composer-actions {
      display: flex;
      justify-content: space-between;
      gap: 10px;
      align-items: center;
      flex-wrap: wrap;
    }
    .file-chip {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      border-radius: 999px;
      padding: 7px 10px;
      border: 1px solid rgba(255,255,255,.10);
      background: rgba(255,255,255,.05);
      font-size: 12px;
    }
    .file-chip.upload-chip {
      border-radius: 16px;
      padding: 7px 8px;
      max-width: min(100%, 310px);
      min-width: 190px;
      align-items: center;
    }
    .upload-chip-preview,
    .upload-status-thumb {
      width: 42px;
      height: 42px;
      flex: 0 0 42px;
      border-radius: 12px;
      overflow: hidden;
      display: grid;
      place-items: center;
      border: 1px solid rgba(255,255,255,.10);
      background: rgba(255,255,255,.07);
      color: var(--muted);
      font-size: 16px;
    }
    .upload-chip-preview img,
    .upload-status-thumb img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }
    .upload-chip-meta,
    .upload-status-body {
      display: grid;
      gap: 4px;
      min-width: 0;
      flex: 1 1 auto;
    }
    .upload-chip-name,
    .upload-status-name {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      color: var(--text);
      font-weight: 700;
    }
    .upload-chip-sub,
    .upload-status-meta {
      color: var(--muted);
      font-size: 11px;
      line-height: 1.2;
    }
    .upload-status-row {
      display: grid;
      gap: 7px;
      padding: 9px 10px;
      border: 1px solid rgba(122,167,255,.22);
      border-radius: 14px;
      background: rgba(122,167,255,.08);
    }
    .upload-status-row[hidden] {
      display: none;
    }
    .upload-status-item {
      display: grid;
      grid-template-columns: 42px minmax(0, 1fr) auto;
      gap: 10px;
      align-items: center;
      min-width: 0;
    }
    .upload-status-item + .upload-status-item {
      padding-top: 10px;
      border-top: 1px solid rgba(255,255,255,.08);
    }
    .upload-status-body .upload-progress-track {
      margin-top: 2px;
    }
    .upload-status-head {
      display: flex;
      justify-content: space-between;
      gap: 12px;
      color: var(--muted);
      font-size: 12px;
      align-items: center;
    }
    .upload-progress-track {
      height: 8px;
      border-radius: 999px;
      overflow: hidden;
      background: rgba(255,255,255,.10);
    }
    .upload-progress-fill {
      height: 100%;
      width: 0%;
      border-radius: inherit;
      background: rgba(122,167,255,.72);
      transition: width .15s ease;
    }
    .upload-cancel-btn {
      width: 28px;
      height: 28px;
      min-width: 28px;
      border-radius: 999px;
      border: 1px solid rgba(255,90,90,.45);
      background: rgba(255,60,60,.16);
      color: #ff8b8b;
      display: inline-grid;
      place-items: center;
      font-size: 18px;
      line-height: 1;
      font-weight: 900;
      cursor: pointer;
      padding: 0;
    }
    .upload-cancel-btn:hover,
    .upload-cancel-btn:focus-visible {
      background: rgba(255,60,60,.26);
      border-color: rgba(255,120,120,.72);
      color: #ffd0d0;
    }
    .upload-status-cancel {
      justify-self: end;
    }
    .upload-chip-cancel {
      margin-left: auto;
    }


    .message-ref {
      cursor: pointer;
      border-left: 3px solid rgba(122,167,255,.72);
      width: 100%;
      text-align: left;
      font: inherit;
      box-shadow: none;
    }
    .message-ref:hover,
    .message-ref:focus-visible {
      background: rgba(122,167,255,.12);
      border-color: rgba(122,167,255,.95);
      outline: none;
    }
    .message-code-block {
      margin: 8px 0;
      border: 1px solid rgba(255,255,255,.14);
      border-radius: 12px;
      overflow: hidden;
      background: rgba(2,6,23,.72);
    }
    .message-code-label {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 6px 10px;
      color: var(--muted);
      font-size: 11px;
      font-weight: 800;
      letter-spacing: .02em;
      text-transform: uppercase;
      border-bottom: 1px solid rgba(255,255,255,.10);
      background: rgba(255,255,255,.04);
    }
    .ace-message-editor {
      width: 100%;
      min-height: 88px;
      font-size: 13px;
      line-height: 1.45;
    }
    .ace-message-fallback {
      margin: 0;
      padding: 10px 12px;
      overflow: auto;
      white-space: pre;
      font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      color: var(--text);
    }
    .return-current-btn {
      position: absolute;
      right: 22px;
      bottom: 124px;
      z-index: 8;
      min-height: 36px;
      padding: 8px 12px;
      border-radius: 999px;
      box-shadow: 0 16px 36px rgba(0,0,0,.34);
      opacity: 0;
      transform: translateY(8px);
      pointer-events: none;
      transition: opacity .15s ease, transform .15s ease;
    }
    .return-current-btn.show {
      opacity: 1;
      transform: translateY(0);
      pointer-events: auto;
    }
    .upload-status-scope {
      color: var(--muted);
      font-weight: 700;
    }

    .empty {
      border: 1px dashed rgba(255,255,255,.14);
      border-radius: 14px;
      padding: 16px;
      color: var(--muted);
      background: rgba(255,255,255,.025);
      line-height: 1.5;
    }

    .project-metadata-modal-card { max-width:min(760px, calc(100vw - 28px)); }
    .project-metadata-modal-card textarea { min-height:120px; resize:vertical; }
    .login-overlay, .modal {
      position: fixed;
      inset: 0;
      display: none;
      place-items: center;
      z-index: 40;
      padding: 20px;
      background: rgba(4,8,16,.76);
      backdrop-filter: blur(12px);
    }
    .project-metadata-modal-card { max-width:min(760px, calc(100vw - 28px)); }
    .project-metadata-modal-card textarea { min-height:120px; resize:vertical; }
    .login-overlay.show, .modal.show { display: grid; }

    .image-modal {
      --image-viewer-width: calc(100vw - 36px);
      --image-viewer-height: calc(100vh - 36px);
      --image-viewer-height: calc(100lvh - 36px);
      position: fixed;
      inset: 0;
      width: 100vw;
      height: 100vh;
      height: 100lvh;
      display: none;
      place-items: center;
      z-index: 60;
      padding: 18px;
      background: rgba(3, 6, 12, .88);
      backdrop-filter: blur(12px);
      overflow: hidden;
      box-sizing: border-box;
      overscroll-behavior: contain;
    }
    .image-modal.show { display: grid; }
    body.image-viewer-open { overflow: hidden; }
    .image-modal-backdrop {
      position: absolute;
      inset: 0;
    }
    .image-modal-content {
      position: relative;
      z-index: 1;
      width: min(1800px, var(--image-viewer-width));
      height: min(1100px, var(--image-viewer-height));
      max-width: var(--image-viewer-width);
      max-height: var(--image-viewer-height);
      display: grid;
      place-items: center;
      padding: 0;
      overflow: hidden;
      box-sizing: border-box;
      min-width: 0;
      min-height: 0;
    }
    .image-modal-content img {
      display: block;
      width: auto;
      height: auto;
      max-width: 100%;
      max-height: 100%;
      object-fit: contain;
      user-select: none;
      cursor: zoom-out;
      box-sizing: border-box;
    }

    .card {
      width: min(760px, 100%);
      border-radius: 24px;
      padding: 24px;
      display: grid;
      gap: 16px;
      background:
        radial-gradient(circle at top left, rgba(91,140,255,.08), transparent 0 30%),
        linear-gradient(180deg, rgba(18,24,37,.98), rgba(14,19,29,.98));
      box-shadow: var(--shadow-lg);
    }
    .card h2, .card h3 { margin: 0; }
    .grid-2, .grid-3 {
      display: grid;
      gap: 12px;
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

    .status-line {
      min-height: 20px;
      color: var(--muted);
      font-size: 13px;
    }
    .status-line.bad { color: var(--danger); }
    .status-line.ok { color: var(--ok); }

    .message-ref {
      margin-top: 8px;
      padding: 9px 10px;
      border-radius: 12px;
      border-left: 3px solid rgba(122,167,255,.35);
      background: rgba(255,255,255,.04);
      color: var(--muted);
      font-size: 12px;
      display: grid;
      gap: 4px;
    }
    .message-actions {
      display: none;
    }
    .message.link-target {
      outline: 2px solid rgba(122,167,255,.75);
      outline-offset: 4px;
      background: rgba(122,167,255,.08);
      transition: outline-color .2s ease, background .2s ease;
    }

    .context-menu {
      position: fixed;
      z-index: 80;
      min-width: 240px;
      max-width: min(320px, calc(100vw - 20px));
      border-radius: 18px;
      border: 1px solid rgba(255,255,255,.12);
      background:
        radial-gradient(circle at top left, rgba(91,140,255,.12), transparent 0 34%),
        linear-gradient(180deg, rgba(21,28,42,.98), rgba(12,17,28,.98));
      box-shadow: var(--shadow-lg);
      padding: 10px;
      display: grid;
      gap: 8px;
      backdrop-filter: blur(18px);
    }
    .context-menu[hidden] { display: none !important; }
    .context-menu-head {
      padding: 8px 10px 6px;
      border-bottom: 1px solid rgba(255,255,255,.06);
      display: grid;
      gap: 4px;
    }
    .context-menu-title {
      font-weight: 800;
      font-size: 14px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .context-menu-subtitle {
      color: var(--muted);
      font-size: 12px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .context-menu-list {
      display: grid;
      gap: 4px;
    }
    .context-menu-btn {
      width: 100%;
      border-radius: 12px;
      padding: 10px 12px;
      text-align: left;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      background: rgba(255,255,255,.04);
      border: 1px solid transparent;
    }
    .context-menu-btn:hover {
      background: rgba(255,255,255,.08);
      border-color: rgba(255,255,255,.08);
      box-shadow: none;
    }
    .context-menu-btn .hint {
      color: var(--muted);
      font-size: 12px;
    }
    .context-menu-btn.danger-text {
      color: #ffc2cf;
    }
    .context-menu-fanout {
      position: relative;
      min-width: 0;
    }
    .context-menu-btn-meta {
      display: inline-flex;
      align-items: center;
      justify-content: flex-end;
      gap: 7px;
      min-width: 0;
    }
    .context-menu-fanout-arrow {
      color: var(--muted);
      font-size: 19px;
      line-height: 1;
      transform: translateY(-1px);
    }
    .context-menu-fanout-menu {
      position: absolute;
      z-index: 3;
      top: -7px;
      left: calc(100% + 8px);
      width: 224px;
      padding: 8px;
      display: grid;
      gap: 4px;
      border-radius: 16px;
      border: 1px solid rgba(255,255,255,.12);
      background: linear-gradient(180deg, rgba(21,28,42,.99), rgba(12,17,28,.99));
      box-shadow: var(--shadow-lg);
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
      transform: translateX(-4px);
      transition: opacity .12s ease, transform .12s ease, visibility .12s;
      backdrop-filter: blur(18px);
    }
    .context-menu[data-fanout-side="left"] .context-menu-fanout-menu {
      left: auto;
      right: calc(100% + 8px);
      transform: translateX(4px);
    }
    .context-menu-fanout:hover > .context-menu-fanout-menu,
    .context-menu-fanout:focus-within > .context-menu-fanout-menu {
      opacity: 1;
      visibility: visible;
      pointer-events: auto;
      transform: translateX(0);
    }
    .context-menu-fanout-title {
      padding: 5px 8px 4px;
      color: var(--muted);
      font-size: 11px;
      font-weight: 800;
      letter-spacing: .04em;
      text-transform: uppercase;
    }
    .context-menu-fanout-btn {
      padding-block: 9px;
    }

    .profile-shell {
      display: grid;
      gap: 16px;
    }
    .profile-hero {
      display: grid;
      grid-template-columns: auto 1fr;
      gap: 14px;
      align-items: center;
      padding: 14px;
      border-radius: 18px;
      border: 1px solid rgba(255,255,255,.08);
      background: rgba(255,255,255,.03);
    }
    .profile-hero .avatar {
      width: 64px;
      height: 64px;
      border-radius: var(--chat-roundness-lg);
      font-size: 20px;
    }
    .profile-hero-copy {
      min-width: 0;
      display: grid;
      gap: 6px;
    }
    .profile-hero-copy .name-row {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      min-width: 0;
    }
    .profile-username {
      color: var(--muted);
      font-size: 13px;
      font-family: var(--mono);
    }
    .profile-bio {
      color: var(--muted);
      line-height: 1.6;
      white-space: pre-wrap;
      word-break: break-word;
    }
    .profile-stats {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 10px;
    }
    .profile-stat {
      padding: 12px;
      border-radius: 14px;
      border: 1px solid rgba(255,255,255,.08);
      background: rgba(255,255,255,.03);
      display: grid;
      gap: 4px;
    }
    .profile-stat-label {
      color: var(--muted);
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: .08em;
    }
    .profile-stat-value {
      font-weight: 800;
      line-height: 1.4;
      word-break: break-word;
    }
    .profile-actions {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
    }

    .profile-avatar-editor {
      display: grid;
      grid-template-columns: auto 1fr;
      gap: 14px;
      align-items: center;
      padding: 12px;
      border-radius: 16px;
      border: 1px solid rgba(255,255,255,.08);
      background: rgba(255,255,255,.03);
    }
    .profile-avatar-preview {
      width: 76px;
      height: 76px;
      display: grid;
      place-items: center;
    }
    .profile-avatar-preview .avatar {
      width: 76px;
      height: 76px;
      border-radius: 22px;
      font-size: 22px;
    }
    .room-image-preview {
      width: 96px;
      height: 72px;
      border-radius: 18px;
      display: grid;
      place-items: center;
      overflow: hidden;
      border: 1px solid rgba(255,255,255,.12);
      background: rgba(255,255,255,.04);
      color: var(--accent-3);
      font-size: 26px;
      font-weight: 900;
    }
    .room-image-preview img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }
    .avatar-editor-copy {
      display: grid;
      gap: 8px;
      min-width: 0;
    }
    .avatar-crop-panel {
      display: grid;
      grid-template-columns: minmax(180px, 220px) 1fr;
      gap: 14px;
      align-items: center;
      padding: 12px;
      border-radius: 16px;
      border: 1px solid rgba(122,167,255,.20);
      background: rgba(91,140,255,.07);
    }
    .avatar-crop-panel[hidden] {
      display: none;
    }
    #avatarCropCanvas {
      width: min(220px, 100%);
      aspect-ratio: 1 / 1;
      border-radius: 22px;
      border: 1px solid rgba(255,255,255,.14);
      background: rgba(0,0,0,.18);
      cursor: grab;
      touch-action: none;
    }
    #avatarCropCanvas.dragging {
      cursor: grabbing;
    }
    .avatar-crop-controls {
      display: grid;
      gap: 10px;
      min-width: 0;
    }
    .avatar-crop-controls label {
      display: grid;
      gap: 5px;
      color: var(--muted);
      font-size: 12px;
    }
    .avatar-crop-controls input[type="range"] {
      width: 100%;
    }
    @media (max-width: 620px) {
      .profile-avatar-editor,
      .avatar-crop-panel {
        grid-template-columns: 1fr;
      }
    }

    .unread-badge {
      min-width: 22px;
      height: 22px;
      padding: 0 8px;
      border-radius: 999px;
      display: inline-grid;
      place-items: center;
      background: linear-gradient(180deg, rgba(91,140,255,.42), rgba(91,140,255,.26));
      border: 1px solid rgba(122,167,255,.24);
      font-size: 11px;
      font-weight: 800;
      color: white;
    }
    .typing-indicator {
      min-height: 18px;
      height: 18px;
      max-height: 18px;
      min-width: 0;
      padding: 0 2px;
      color: var(--muted);
      font-size: 12px;
      line-height: 18px;
      opacity: .95;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      contain: layout paint;
      transition: color .18s ease, opacity .18s ease;
    }
    .typing-active { color: var(--accent-2); }
    .status-live { color: var(--ok); }
    .status-connecting { color: var(--warn); }
    .status-offline-pill { color: var(--danger); }

    .sidebar-meter {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 10px;
      width: 100%;
    }
    .mini-stat {
      padding: 10px 12px;
      border-radius: 14px;
      border: 1px solid var(--line);
      background: rgba(255,255,255,.03);
      display: grid;
      gap: 4px;
    }
    .mini-stat .label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
    .mini-stat .value { font-weight: 800; font-size: 1rem; }

    .detail-stack { display: grid; gap: 14px; }

    .mobile-switcher {
      display: none;
      gap: 8px;
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .mobile-switcher button {
      min-height: 44px;
      font-weight: 700;
    }
    .mobile-switcher button.active {
      background: linear-gradient(180deg, rgba(91,140,255,.28), rgba(91,140,255,.16));
      border-color: rgba(122,167,255,.30);
    }

    [hidden] { display: none !important; }

    @media (max-width: 1540px) {
      .workspace { grid-template-columns: 76px 300px minmax(0, 1fr) 76px; }
      .detail-pane { display: none; }
      .detail-pane.members-only-pane {
        display: grid;
        grid-template-rows: minmax(0, 1fr);
      }
      body.chat-sidebar-collapsed .workspace {
        grid-template-columns: 0 0 minmax(0, 1fr) 76px;
      }
      .members-only-pane .detail-body {
        padding: 10px;
        gap: 10px;
        overflow-x: hidden;
      }
      .members-only-pane .members-pane-section {
        padding: 10px;
        gap: 10px;
        align-content: start;
      }
      .members-only-pane .section-title {
        overflow: hidden;
        width: 100%;
        text-align: center;
        white-space: nowrap;
        font-size: 0;
      }
      .members-only-pane .section-title::before {
        content: "👥";
        font-size: 18px;
        line-height: 1;
      }
      .members-only-pane #memberList {
        align-items: center;
        gap: 7px;
      }
      .members-only-pane .member-item.compact-member {
        width: 48px;
        min-width: 48px;
        min-height: 48px;
        height: 48px;
        padding: 0;
        display: grid;
        place-items: center;
        cursor: context-menu;
        overflow: hidden;
      }
      .members-only-pane .member-item.compact-member .person {
        width: 100%;
        justify-content: center;
        gap: 0;
      }
      .members-only-pane .member-item.compact-member .avatar {
        width: 34px;
        height: 34px;
      }
      .members-only-pane .member-item.compact-member .name-block {
        display: none;
      }
      .members-only-pane .empty {
        width: 48px;
        min-height: 48px;
        padding: 8px 4px;
        display: grid;
        place-items: center;
        text-align: center;
        font-size: 11px;
        line-height: 1.15;
      }
    }

    @media (max-width: 1540px) and (min-width: 1081px) {
      .workspace { grid-template-columns: 76px 300px minmax(0, 1fr) minmax(260px, 300px); }
      body.chat-sidebar-collapsed .workspace { grid-template-columns: 0 0 minmax(0, 1fr) minmax(260px, 300px); }
      .detail-pane.members-only-pane { display: grid; grid-template-rows: minmax(0, 1fr); }
      .members-only-pane .detail-body { padding: 12px; gap: 12px; overflow: auto; }
      .members-only-pane .members-pane-section { min-height: auto; padding: 0; gap: 10px; align-content: start; }
      .members-only-pane .section-title { width: auto; text-align: left; white-space: normal; font-size: 11px; overflow: visible; }
      .members-only-pane .section-title::before { content: none; }
      .members-only-pane #memberList { align-items: stretch; gap: 5px; }
      .members-only-pane .member-item.compact-member { width: 100%; min-width: 0; min-height: 42px; height: auto; padding: 5px 8px; display: grid; place-items: stretch; }
      .members-only-pane .member-item.compact-member .person { display: flex; gap: 8px; }
      .members-only-pane .member-item.compact-member .avatar { width: 32px; height: 32px; }
      .members-only-pane .member-item.compact-member .name-block { display: grid; }
      .members-only-pane .member-item.compact-member .name { font-size: 12.5px; max-width: 150px; padding-top: 0; }
      .members-only-pane .member-item.compact-member .subline { display: block; }
      .members-only-pane .conversation-content-section { display: grid; }
    }

    @media (min-width: 901px) and (max-height: 760px) {
      .members-only-pane .detail-body {
        padding: 8px;
        gap: 8px;
      }
      .members-only-pane .members-pane-section {
        gap: 6px;
      }
      .members-only-pane #memberList {
        max-height: min(60vh, 400px);
        gap: 4px;
      }
      .members-only-pane .member-item.compact-member {
        min-height: 38px;
        padding: 4px 7px;
      }
      .members-only-pane .member-item.compact-member .person {
        gap: 7px;
        min-height: 28px;
      }
      .members-only-pane .member-item.compact-member .avatar {
        width: 29px;
        height: 29px;
        border-radius: 10px;
      }
      .members-only-pane .member-item.compact-member .name {
        font-size: 12px;
      }
      .members-only-pane .member-item.compact-member .subline {
        font-size: 10px;
        line-height: 1.15;
      }
    }

    @media (max-width: 1080px) and (min-width: 901px) {
      body { overflow: hidden; }
      .shell {
        height: var(--chat-viewport-height, 100lvh);
        min-height: var(--chat-viewport-height, 100lvh);
        max-height: var(--chat-viewport-height, 100lvh);
        grid-template-rows: auto minmax(0, 1fr);
      }
      .workspace {
        grid-template-columns: 72px minmax(240px, 300px) minmax(0, 1fr);
        min-height: 0;
        height: 100%;
      }
      body.chat-sidebar-collapsed .workspace { grid-template-columns: 0 minmax(0, 1fr); }
      .detail-pane,
      .detail-pane.members-only-pane { display: none; }
      .rail {
        display: grid;
        align-content: start;
        gap: 10px;
        padding: 10px;
      }
      .rail-btn {
        width: 100%;
        min-width: 0;
      }
      .sidebar { max-height: none; }
      .chat-pane { min-height: 0; height: 100%; }
      .mobile-switcher { display: none; }
    }

    @media (max-width: 900px) {
      .shell {
        padding: 10px;
        gap: 10px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
      }
      .topbar, .rail, .sidebar, .chat-pane, .detail-pane { border-radius: 16px; }
      .grid-2, .grid-3 { grid-template-columns: 1fr; }
      .toolbar {
        width: 100%;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 2px;
      }
      .toolbar > * { flex: 0 0 auto; justify-content: center; }
      .sidebar-meter { grid-template-columns: 1fr; }
      .chat-title-main { align-items: flex-start; }
      .chat-glyph { display: none; }
      .brand .subtitle { display: none; }
      .workspace {
        position: relative;
        display: block;
      }
      .rail { display: none; }
      .sidebar, .chat-pane, .detail-pane {
        display: none;
        min-height: 0;
        height: 100%;
      }
      body.mobile-sidebar .sidebar,
      body.mobile-chat .chat-pane,
      body.mobile-details .detail-pane {
        display: grid;
      }
      .sidebar, .chat-pane, .detail-pane {
        max-height: none;
      }
      .chat-body, .sidebar-body, .detail-body {
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
      }
      .composer-actions,
      .composer-actions .inline {
        width: 100%;
      }
      .composer-actions .inline {
        justify-content: space-between;
      }
      .composer-actions button {
        flex: 1 1 0;
      }
      #chatMetaChips {
        width: 100%;
      }
      #chatMetaChips .pill {
        flex: 1 1 auto;
        justify-content: center;
      }
    }

    @media (max-width: 640px) {
      .topbar { padding: 12px 14px; }
      .brand { gap: 10px; }
      .badge { width: 42px; height: 42px; border-radius: 14px; font-size: 20px; }
      .pill { min-height: 34px; padding: 7px 10px; }
      .sidebar-head, .detail-head, .chat-head, .composer { padding: 12px; }
      .sidebar-body, .detail-body, .chat-body { padding: 12px; }
      .message { grid-template-columns: 40px minmax(0, 1fr) auto; }
      .message-hover-actions {
        right: 8px;
        top: -10px;
        max-width: calc(100vw - 36px);
        overflow-x: auto;
      }
      .message:not(.action-message):has(> .message-receipts.room-receipt-row > .receipt-dot) .message-hover-actions {
        right: 100px;
      }
      .message-receipts { max-width: 86px; padding-top: 13px; }
      .message .avatar { width: 40px; height: 40px; }
      textarea { min-height: 88px; }
    }
  

    
    :root {
      --bg: #0f1418;
      --bg-elevated: #121920;
      --bg-soft: #151d24;
      --bg-softer: #1a232c;
      --panel: rgba(16, 20, 26, 0.96);
      --panel-2: rgba(18, 23, 30, 0.98);
      --panel-3: rgba(255,255,255,.04);
      --line: rgba(255,255,255,.08);
      --line-strong: rgba(255,255,255,.12);
      --text: #eff7f0;
      --muted: #9aa79e;
      --muted-2: #7f8c84;
      --accent: #58c76f;
      --accent-2: #8beca0;
      --accent-3: #b8f8c3;
      --danger: #ff7b97;
      --warn: #ffcf7a;
      --ok: #79ebb1;
      --shadow: 0 20px 48px rgba(0,0,0,.28);
      --shadow-lg: 0 28px 72px rgba(0,0,0,.36);
      --radius: 16px;
      --radius-sm: 12px;
      --chat-roundness: 16px;
      --chat-roundness-sm: 12px;
      --chat-roundness-lg: 18px;
    }

    body {
      background:
        radial-gradient(circle at top left, rgba(88,199,111,.12), transparent 0 22%),
        linear-gradient(180deg, #0d1117 0%, #111821 100%);
    }

    button.primary {
      background: rgba(88, 199, 111, .22);
      border-color: rgba(140, 236, 160, .26);
    }
    button.secondary {
      background: rgba(88, 199, 111, .14);
      border-color: rgba(140, 236, 160, .20);
    }
    button.warn {
      background: rgba(255, 207, 122, .12);
      border-color: rgba(255, 207, 122, .18);
    }
    .topbar,
    .rail,
    .sidebar,
    .chat-pane,
    .detail-pane,
    .card,
    .section {
      background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
      border: 1px solid rgba(255,255,255,.08);
      box-shadow: inset 0 0 0 1px rgba(255,255,255,.02);
    }
    .topbar::before {
      background: linear-gradient(90deg, transparent, rgba(140,236,160,.34), transparent);
    }
    .rail-btn.active {
      background: rgba(88, 199, 111, .12);
      border-color: rgba(140, 236, 160, .28);
    }
    .rail-btn.active::before {
      background: var(--accent);
    }
    .section {
      gap: 10px;
      padding: 12px;
      border-radius: var(--chat-roundness);
      padding-bottom: 12px;
    }
    .section-title {
      color: var(--text);
      font-size: 13px;
      letter-spacing: 0;
      text-transform: none;
      font-weight: 700;
      padding: 0;
    }
    .sidebar-head,
    .detail-head,
    .chat-head,
    .composer {
      background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
    }
    .sidebar-meter {
      gap: 8px;
    }
    .mini-stat {
      border-radius: var(--chat-roundness-sm);
      border: 1px solid rgba(255,255,255,.08);
      background: rgba(255,255,255,.04);
      padding: 10px 12px;
    }
    .mini-stat .label {
      text-transform: none;
      letter-spacing: 0;
      font-size: 12px;
    }
    .nav-item, .friend-item, .member-item, .search-user, .blocked-item, .empty, .message, .message-ref, .pill, .file-chip, .context-menu {
      border-radius: var(--chat-roundness);
    }
    .nav-item, .friend-item, .member-item, .search-user, .blocked-item {
      border-color: rgba(255,255,255,.08);
      background: rgba(255,255,255,.04);
      box-shadow: none;
    }
    .nav-item:hover, .friend-item:hover, .member-item:hover, .search-user:hover, .blocked-item:hover {
      background: rgba(255,255,255,.07);
      border-color: rgba(255,255,255,.10);
    }
    .nav-item.active {
      background: rgba(88, 199, 111, .12);
      border-color: rgba(140, 236, 160, .28);
      box-shadow: none;
    }
    .avatar, .avatar.small, .chat-glyph {
      border-radius: 14px;
      background: rgba(88, 199, 111, .18);
      border-color: rgba(140, 236, 160, .22);
      color: #effff4;
      box-shadow: none;
    }
    .chat-body,
    .sidebar-body,
    .detail-body {
      gap: 12px;
      background: linear-gradient(180deg, rgba(255,255,255,.025), rgba(255,255,255,.01));
    }
    .message {
      background: transparent;
      border-color: transparent;
      box-shadow: none;
      transform: none;
    }
    .message:hover {
      background: rgba(255,255,255,.035);
      border-color: transparent;
      transform: none;
    }
    .message.context-open {
      background: rgba(88, 199, 111, .08);
      border-color: rgba(140, 236, 160, .16);
      box-shadow: inset 3px 0 0 rgba(140, 236, 160, .38);
    }
    .message.mine {
      background: transparent;
      border-color: transparent;
      box-shadow: none;
    }
    .message-ref {
      border-left-color: rgba(140, 236, 160, .42);
      background: rgba(255,255,255,.04);
    }
    .composer textarea,
    .composer input,
    .composer select,
    .composer-editor,
    .detail-pane input,
    .sidebar input {
      background: rgba(0,0,0,.22);
      border-color: rgba(255,255,255,.12);
    }

    .message-ref {
      cursor: pointer;
      border-left: 3px solid rgba(122,167,255,.72);
      width: 100%;
      text-align: left;
      font: inherit;
      box-shadow: none;
    }
    .message-ref:hover,
    .message-ref:focus-visible {
      background: rgba(122,167,255,.12);
      border-color: rgba(122,167,255,.95);
      outline: none;
    }
    .message-code-block {
      margin: 8px 0;
      border: 1px solid rgba(255,255,255,.14);
      border-radius: 12px;
      overflow: hidden;
      background: rgba(2,6,23,.72);
    }
    .message-code-label {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 6px 10px;
      color: var(--muted);
      font-size: 11px;
      font-weight: 800;
      letter-spacing: .02em;
      text-transform: uppercase;
      border-bottom: 1px solid rgba(255,255,255,.10);
      background: rgba(255,255,255,.04);
    }
    .ace-message-editor {
      width: 100%;
      min-height: 88px;
      font-size: 13px;
      line-height: 1.45;
    }
    .ace-message-fallback {
      margin: 0;
      padding: 10px 12px;
      overflow: auto;
      white-space: pre;
      font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      color: var(--text);
    }
    .return-current-btn {
      position: absolute;
      right: 22px;
      bottom: 124px;
      z-index: 8;
      min-height: 36px;
      padding: 8px 12px;
      border-radius: 999px;
      box-shadow: 0 16px 36px rgba(0,0,0,.34);
      opacity: 0;
      transform: translateY(8px);
      pointer-events: none;
      transition: opacity .15s ease, transform .15s ease;
    }
    .return-current-btn.show {
      opacity: 1;
      transform: translateY(0);
      pointer-events: auto;
    }
    .upload-status-scope {
      color: var(--muted);
      font-weight: 700;
    }

    .empty {
      border-style: solid;
      background: rgba(255,255,255,.03);
    }
    .overview-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }
    .sidebar-overview-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 8px;
    }
    .overview-card,
    .overview-panel {
      border: 1px solid rgba(255,255,255,.08);
      border-radius: var(--chat-roundness-sm);
      background: rgba(255,255,255,.04);
      padding: 10px 12px;
      display: grid;
      gap: 4px;
    }
    .overview-panel {
      margin-top: 8px;
    }

    button.overview-card {
      appearance: none;
      width: 100%;
      color: inherit;
      font: inherit;
      text-align: left;
      cursor: pointer;
    }
    button.overview-card:hover {
      background: rgba(255,255,255,.07);
      border-color: rgba(255,255,255,.14);
    }
    .overview-card .label,
    .overview-panel .label {
      font-size: 12px;
      color: var(--muted);
    }
    .overview-card .value {
      font-size: 1.15rem;
      font-weight: 800;
      color: var(--text);
    }
    .overview-card .caption,
    .overview-panel .caption {
      font-size: 12px;
      color: var(--muted);
      line-height: 1.4;
    }
    .overview-panel .value {
      font-size: 13px;
      font-weight: 700;
      color: var(--text);
      line-height: 1.4;
    }
    .sidebar-section[hidden] {
      display: none !important;
    }

    .admin-rooms-section {
      margin-top: 6px;
      border-color: rgba(245, 158, 11, .28) !important;
      background: linear-gradient(180deg, rgba(245, 158, 11, .10), rgba(255,255,255,.02)) !important;
      box-shadow: inset 0 0 0 1px rgba(245, 158, 11, .08);
    }
    .admin-rooms-section .section-title {
      color: #fbbf24;
    }
    .admin-rooms-section .section-title::before {
      content: "🛡️";
      margin-right: 6px;
      font-size: 12px;
    }

    @media (max-width: 760px) {
      .sidebar-overview-grid {
        grid-template-columns: 1fr;
      }
    }


    
    :root[data-chat-theme="forest"] {
      --theme-rgb: 88, 199, 111;
      --theme-rgb-2: 140, 236, 160;
      --theme-bg-start: #0d1117;
      --theme-bg-end: #111821;
      --accent: #58c76f;
      --accent-2: #8beca0;
      --accent-3: #b8f8c3;
      --text: #eff7f0;
      --muted: #9aa79e;
      --muted-2: #7f8c84;
    }
    :root[data-chat-theme="ocean"] {
      --theme-rgb: 73, 165, 255;
      --theme-rgb-2: 125, 211, 252;
      --theme-bg-start: #08111f;
      --theme-bg-end: #0d1b2d;
      --accent: #49a5ff;
      --accent-2: #7dd3fc;
      --accent-3: #c7eaff;
      --text: #eef7ff;
      --muted: #9eb3c9;
      --muted-2: #7f94ad;
    }
    :root[data-chat-theme="violet"] {
      --theme-rgb: 139, 92, 246;
      --theme-rgb-2: 196, 181, 253;
      --theme-bg-start: #120d1f;
      --theme-bg-end: #1b1430;
      --accent: #8b5cf6;
      --accent-2: #c4b5fd;
      --accent-3: #ddd6fe;
      --text: #f6f1ff;
      --muted: #b5a7cc;
      --muted-2: #9685b5;
    }
    :root[data-chat-theme="rose"] {
      --theme-rgb: 244, 114, 182;
      --theme-rgb-2: 251, 207, 232;
      --theme-bg-start: #1a0d16;
      --theme-bg-end: #25111f;
      --accent: #f472b6;
      --accent-2: #fbcfe8;
      --accent-3: #ffe4f2;
      --text: #fff1f8;
      --muted: #c8a2b6;
      --muted-2: #a9869b;
    }
    :root[data-chat-theme="amber"] {
      --theme-rgb: 245, 158, 11;
      --theme-rgb-2: 252, 211, 77;
      --theme-bg-start: #171109;
      --theme-bg-end: #21180d;
      --accent: #f59e0b;
      --accent-2: #fcd34d;
      --accent-3: #fde68a;
      --text: #fff8ed;
      --muted: #c4ad8a;
      --muted-2: #a68e69;
    }
    :root[data-chat-theme="slate"] {
      --theme-rgb: 148, 163, 184;
      --theme-rgb-2: 203, 213, 225;
      --theme-bg-start: #0f141b;
      --theme-bg-end: #151c25;
      --accent: #94a3b8;
      --accent-2: #cbd5e1;
      --accent-3: #e2e8f0;
      --text: #f1f5f9;
      --muted: #a7b0bd;
      --muted-2: #8792a1;
    }
    :root[data-chat-theme] body {
      background:
        radial-gradient(circle at top left, rgba(var(--theme-rgb), .14), transparent 0 22%),
        radial-gradient(circle at top right, rgba(var(--theme-rgb-2), .08), transparent 0 18%),
        linear-gradient(180deg, var(--theme-bg-start) 0%, var(--theme-bg-end) 100%);
    }
    :root[data-chat-theme] .topbar::before {
      background: linear-gradient(90deg, transparent, rgba(var(--theme-rgb-2), .34), transparent);
    }
    :root[data-chat-theme] button.primary {
      background: rgba(var(--theme-rgb), .22);
      border-color: rgba(var(--theme-rgb-2), .26);
    }
    :root[data-chat-theme] button.secondary {
      background: rgba(var(--theme-rgb), .14);
      border-color: rgba(var(--theme-rgb-2), .20);
    }
    :root[data-chat-theme] .rail-btn.active,
    :root[data-chat-theme] .nav-item.active {
      background: rgba(var(--theme-rgb), .12);
      border-color: rgba(var(--theme-rgb-2), .28);
    }
    :root[data-chat-theme] .rail-btn.active::before {
      background: var(--accent);
    }
    :root[data-chat-theme] .avatar,
    :root[data-chat-theme] .avatar.small,
    :root[data-chat-theme] .chat-glyph {
      background: rgba(var(--theme-rgb), .18);
      border-color: rgba(var(--theme-rgb-2), .22);
      color: var(--accent-3);
    }
    :root[data-chat-theme] .message.context-open {
      background: rgba(var(--theme-rgb), .08);
      border-color: rgba(var(--theme-rgb-2), .16);
      box-shadow: inset 3px 0 0 rgba(var(--theme-rgb-2), .38);
    }
    :root[data-chat-theme] .message-ref {
      border-left-color: rgba(var(--theme-rgb-2), .42);
    }
    :root[data-chat-theme] .message-tool-btn:hover,
    :root[data-chat-theme] .reaction-chip.mine {
      border-color: rgba(var(--theme-rgb-2), .34);
      background: rgba(var(--theme-rgb), .13);
    }
    :root[data-chat-theme] button:hover,
    :root[data-chat-theme] input:focus,
    :root[data-chat-theme] textarea:focus,
    :root[data-chat-theme] select:focus,
    :root[data-chat-theme] .composer-editor:focus {
      border-color: rgba(var(--theme-rgb-2), .40);
      box-shadow: 0 0 0 3px rgba(var(--theme-rgb), .12);
    }
    .dm-status-dot {
      margin-left: 2px;
    }
    .nav-item.compact-conversation .name-line {
      display: flex;
      align-items: center;
      gap: 7px;
    }
    .nav-item.compact-conversation .name-line .name {
      min-width: 0;
      flex: 1 1 auto;
    }
    .nav-item.compact-conversation .name-line .nav-time-value,
    .nav-item.compact-conversation .name-line .unread-badge {
      flex: 0 0 auto;
    }
    #dmList .unread-badge {
      min-width: 24px;
      height: 24px;
      padding: 0 7px;
      border-radius: 999px;
      box-shadow: 0 0 0 2px rgba(8, 11, 19, .85), 0 8px 18px rgba(0,0,0,.24);
    }
    #dmList .nav-item.compact-conversation {
      backface-visibility: hidden;
      transform: translateZ(0);
      transition: background .12s ease, border-color .12s ease;
    }
    #dmList .nav-item.compact-conversation:hover,
    #dmList .nav-item.compact-conversation:focus-visible,
    :root[data-chat-theme] #dmList .nav-item.compact-conversation:hover {
      box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
      transform: translateZ(0);
    }
    #dmList .nav-item.compact-conversation.opening {
      cursor: progress;
    }

    
    .chat-title-actions {
      margin-left: auto;
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 8px;
      min-width: 0;
      flex: 0 0 auto;
    }
    .chat-title-actions #chatMetaChips {
      justify-content: flex-end;
    }
    .chat-maximize-btn,
    .chat-search-trigger,
    .chat-sound-toggle,
    .chat-notification-bell {
      width: 38px;
      height: 38px;
      padding: 0;
      border-radius: max(0px, calc(var(--chat-roundness-sm) - 1px));
      display: inline-grid;
      place-items: center;
      flex: 0 0 auto;
      background: rgba(255,255,255,.045);
      border-color: rgba(255,255,255,.10);
      color: var(--accent-3);
    }
    .chat-maximize-btn:hover,
    .chat-search-trigger:hover,
    .chat-sound-toggle:hover,
    .chat-notification-bell:hover {
      background: rgba(255,255,255,.08);
      border-color: rgba(var(--theme-rgb-2, 122, 167, 255), .34);
      transform: translateY(-1px);
    }
    .chat-maximize-btn:active,
    .chat-search-trigger:active,
    .chat-sound-toggle:active,
    .chat-notification-bell:active {
      transform: translateY(0);
    }
    .chat-maximize-btn svg,
    .chat-search-trigger svg,
    .chat-sound-toggle svg,
    .chat-notification-bell svg {
      width: 18px;
      height: 18px;
      display: block;
      stroke: currentColor;
      stroke-width: 2;
      fill: none;
      stroke-linecap: round;
      stroke-linejoin: round;
    }
    .chat-maximize-btn .minimize-icon,
    .chat-sound-toggle .sound-off-icon {
      display: none;
    }
    .chat-sound-toggle.muted .sound-on-icon {
      display: none;
    }
    .chat-sound-toggle.muted .sound-off-icon {
      display: block;
    }
    .chat-sound-toggle.muted {
      color: var(--muted);
      background: rgba(255,255,255,.025);
      border-color: rgba(255,255,255,.08);
    }

    .chat-search-trigger.active {
      color: var(--accent-2);
      background: rgba(69,208,181,.12);
      border-color: rgba(69,208,181,.24);
    }
    .chat-message-search {
      margin-top: 12px;
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 9px;
      border-radius: var(--chat-roundness-sm);
      border: 1px solid rgba(255,255,255,.10);
      background: rgba(255,255,255,.035);
      box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
    }
    .chat-message-search[hidden] { display: none !important; }
    .chat-message-search input[type="search"] {
      min-width: min(340px, 42vw);
      flex: 1 1 240px;
      height: 38px;
      padding: 8px 11px;
    }
    .chat-message-search button {
      min-height: 36px;
      padding: 7px 10px;
    }
    .chat-search-status {
      min-width: 94px;
      color: var(--muted);
      font-size: 12px;
      text-align: right;
      white-space: nowrap;
    }
    .message.search-hit {
      background: rgba(255,207,122,.08);
      border-color: rgba(255,207,122,.18);
      box-shadow: inset 3px 0 0 rgba(255,207,122,.45);
    }
    .message.search-active {
      background: rgba(69,208,181,.12);
      border-color: rgba(69,208,181,.34);
      box-shadow: inset 3px 0 0 rgba(69,208,181,.72), 0 0 0 1px rgba(69,208,181,.12);
    }
    mark.chat-search-mark {
      border-radius: 5px;
      padding: 0 .14em;
      background: rgba(255,207,122,.55);
      color: #111827;
      box-decoration-break: clone;
      -webkit-box-decoration-break: clone;
    }
    .message.search-active mark.chat-search-mark {
      background: rgba(104,227,184,.72);
    }

    .chat-notification-wrap {
      position: relative;
      display: inline-flex;
      align-items: center;
      flex: 0 0 auto;
    }
    .chat-notification-bell { position: relative; }
    .chat-notification-bell.has-new::after {
      content: "";
      position: absolute;
      right: 8px;
      top: 7px;
      width: 9px;
      height: 9px;
      border-radius: 50%;
      background: var(--danger);
      box-shadow: 0 0 0 2px rgba(10,15,26,.98), 0 0 12px rgba(255,123,151,.58);
    }
    .chat-notification-bell.has-update-notice::after {
      background: #4da3ff;
      box-shadow: 0 0 0 2px rgba(10,15,26,.98), 0 0 12px rgba(77,163,255,.66);
    }
    .chat-notifications-popover {
      position: fixed;
      right: 12px;
      top: calc(var(--header-h) + 20px);
      z-index: 2147483000;
      pointer-events: auto;
      width: min(420px, calc(100vw - 24px));
      max-height: min(540px, calc(100vh - 96px));
      display: grid;
      grid-template-rows: auto minmax(0, 1fr);
      overflow: hidden;
      border-radius: var(--chat-roundness);
      border: 1px solid var(--line-strong);
      background:
        radial-gradient(circle at top left, rgba(91,140,255,.16), transparent 0 38%),
        linear-gradient(180deg, rgba(18,25,41,.98), rgba(10,15,26,.99));
      box-shadow: var(--shadow-lg);
    }
    .chat-notifications-popover[hidden] { display: none !important; }
    .chat-notifications-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding: 14px 14px 10px;
      border-bottom: 1px solid var(--line);
    }
    .chat-notifications-head strong { font-size: .98rem; }
    .chat-notifications-actions {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 8px;
      flex-wrap: wrap;
    }
    .chat-notifications-actions .slim { white-space: nowrap; }
    .chat-notifications-list {
      min-height: 180px;
      overflow: auto;
      padding: 8px;
      display: grid;
      gap: 6px;
    }
    .chat-notification-item {
      width: 100%;
      min-height: auto;
      display: grid;
      gap: 4px;
      text-align: left;
      padding: 10px 11px;
      border-radius: var(--chat-roundness-sm);
      background: rgba(255,255,255,.035);
      border: 1px solid rgba(255,255,255,.075);
      box-shadow: none;
    }
    .chat-notification-item:hover {
      background: rgba(255,255,255,.07);
      border-color: rgba(122,167,255,.28);
      box-shadow: none;
    }
    .chat-notification-item:disabled { opacity: .82; cursor: default; }
    .chat-notification-title-row {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 10px;
      min-width: 0;
    }
    .chat-notification-title {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-weight: 800;
      color: var(--text);
    }
    .chat-notification-time {
      flex: 0 0 auto;
      color: var(--muted-2);
      font-size: 11px;
    }
    .chat-notification-body {
      color: var(--muted);
      line-height: 1.35;
      font-size: 13px;
      overflow-wrap: anywhere;
    }
    .chat-notifications-foot,
    .chat-notifications-empty {
      color: var(--muted);
      font-size: 13px;
      text-align: center;
      padding: 14px 10px;
    }

    body.chat-layout-booting .shell,
    body.chat-layout-booting .topbar,
    body.chat-layout-booting .workspace,
    body.chat-layout-booting .rail,
    body.chat-layout-booting .sidebar,
    body.chat-layout-booting .chat-pane,
    body.chat-layout-booting .detail-pane {
      transition: none !important;
      animation: none !important;
    }

    .shell,
    .topbar,
    .workspace,
    .rail,
    .sidebar,
    .chat-pane,
    .detail-pane {
      transition:
        opacity .26s ease,
        transform .26s ease,
        border-radius .26s ease,
        box-shadow .26s ease,
        padding .26s ease,
        gap .26s ease,
        grid-template-columns .26s ease;
    }
    .shell { transition: none !important; }

    body.chat-room-maximized {
      overflow: hidden;
    }
    body.chat-room-maximized .shell {
      display: block;
      width: 100vw;
      height: var(--chat-shell-height, var(--chat-viewport-height, 100vh));
      min-height: var(--chat-shell-height, var(--chat-viewport-height, 100vh));
      max-height: var(--chat-shell-height, var(--chat-viewport-height, 100vh));
      padding: 0;
      gap: 0;
    }
    body.chat-room-maximized .topbar {
      opacity: 0;
      transform: translateY(-18px) scale(.98);
      pointer-events: none;
    }
    body.chat-room-maximized .workspace {
      position: fixed;
      inset: 0;
      z-index: 80;
      display: block;
      width: 100vw;
      height: var(--chat-shell-height, var(--chat-viewport-height, 100vh));
      min-height: var(--chat-shell-height, var(--chat-viewport-height, 100vh));
      padding: 0;
      gap: 0;
    }
    body.chat-room-maximized .rail,
    body.chat-room-maximized .sidebar,
    body.chat-room-maximized .detail-pane {
      position: fixed;
      inset: 12px auto 12px 12px;
      width: 0;
      height: auto;
      opacity: 0;
      overflow: hidden;
      pointer-events: none;      transform: translateX(-20px) scale(.96);
    }
    body.chat-room-maximized .detail-pane {
      inset: 12px 12px 12px auto;
      transform: translateX(20px) scale(.96);
    }
    body.chat-room-maximized .chat-pane {
      position: fixed;
      inset: 0;
      z-index: 90;
      display: grid !important;
      grid-template-rows: auto 1fr auto;
      width: 100vw;
      height: var(--chat-shell-height, var(--chat-viewport-height, 100vh));
      max-height: var(--chat-shell-height, var(--chat-viewport-height, 100vh));
      min-height: 0;
      border: 0;
      border-radius: 0;
      box-shadow: none;
      transform: none;
    }
    body.chat-room-maximized .chat-head,
    body.chat-room-maximized .composer {
      border-radius: 0;
    }
    body.chat-room-maximized .chat-body {
      min-height: 0;
    }
    body.chat-room-maximized .chat-maximize-btn {
      background: rgba(var(--theme-rgb, 91, 140, 255), .18);
      border-color: rgba(var(--theme-rgb-2, 122, 167, 255), .34);
      color: var(--accent-3);
    }
    body.chat-room-maximized .chat-maximize-btn .maximize-icon {
      display: none;
    }
    body.chat-room-maximized .chat-maximize-btn .minimize-icon {
      display: block;
    }

    @media (max-width: 900px) {
      .chat-title-row {
        align-items: flex-start;
      }
      .chat-title-actions {
        align-items: flex-start;
      }
      .chat-message-search {
        flex-wrap: wrap;
      }
      .chat-message-search input[type="search"] {
        min-width: 0;
        flex-basis: 100%;
      }
      .chat-title-actions #chatMetaChips {
        width: auto;
      }
      .chat-maximize-btn {
        width: 36px;
        height: 36px;
      }
    }



    @media (max-width: 900px) {
      html,
      body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden !important;
      }
      body.mobile-layout {
        overflow: hidden;
      }
      .shell {
        width: 100%;
        max-width: 100vw;
        height: var(--chat-viewport-height, 100lvh);
        min-height: var(--chat-viewport-height, 100lvh);
        max-height: var(--chat-viewport-height, 100lvh);
        grid-template-rows: auto minmax(0, 1fr);
        overflow: hidden;
      }
      .mobile-switcher {
        display: none !important;
      }
      .topbar {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        min-height: auto;
        align-items: stretch;
        flex-direction: column;
        overflow: hidden;
      }
      .topbar .toolbar,
      .topbar .topbar-status {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
      }
      .topbar-status {
        margin-left: 0;
        justify-content: flex-start;
        padding-bottom: 2px;
      }
      .workspace {
        display: block !important;
        width: 100%;
        max-width: 100%;
        height: 100%;
        min-width: 0;
        min-height: 0;
        position: relative;
        overflow: hidden;
      }
      .rail,
      .detail-pane,
      .detail-pane.members-only-pane {
        display: none !important;
      }
      .chat-pane {
        display: grid !important;
        grid-template-rows: auto minmax(0, 1fr) auto;
        width: 100%;
        max-width: 100%;
        height: 100%;
        min-width: 0;
        min-height: 0;
        max-height: none;
        overflow: hidden;
      }
      .chat-head,
      .chat-body,
      .composer,
      .composer-grid,
      .composer .row,
      .composer-actions,
      .chat-message-search {
        min-width: 0;
        max-width: 100%;
        overflow-x: hidden;
      }
      .chat-head {
        position: relative;
      }
      .chat-title-row {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: nowrap;
        min-width: 0;
      }
      .mobile-chat-drawer-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        min-width: 0;
        min-height: 38px;
        padding: 8px 10px;
        flex: 0 0 auto;
        border-radius: 999px;
        font-weight: 800;
        background: rgba(var(--theme-rgb, 88, 199, 111), .16);
        border-color: rgba(var(--theme-rgb-2, 140, 236, 160), .30);
        color: var(--text);
      }
      .chat-title-main {
        min-width: 0;
        flex: 1 1 auto;
      }
      .chat-title-copy {
        min-width: 0;
      }
      #chatTitle,
      #chatSubtitle {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .chat-title-actions {
        flex: 0 0 auto;
        gap: 6px;
      }
      .chat-title-actions #chatMetaChips {
        display: none;
      }
      .chat-body {
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
        overscroll-behavior: contain;
      }
      .chat-body > *,
      .message,
      .message-body,
      .message-content,
      .message-ref,
      .link-preview-list,
      .attachment-list,
      .upload-status-row,
      .chips,
      .pill,
      .file-chip {
        max-width: 100%;
        min-width: 0;
      }
      .message-content,
      .message-ref,
      .pill,
      .file-chip,
      .composer-editor,
      .chat-message-search input {
        overflow-wrap: anywhere;
        word-break: break-word;
      }
      .message-code-block,
      .message-content pre,
      .message-content code {
        max-width: 100%;
        overflow-x: auto;
      }
      .message-content img,
      .message-content video,
      .message-content iframe,
      .link-preview-list img {
        max-width: 100%;
        height: auto;
      }
      .composer {
        width: 100%;
        max-width: 100%;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        overflow: hidden;
      }
      .composer-editor {
        min-height: 48px;
        max-height: 140px;
        overflow-y: auto;
      }
      .format-toolbar {
        max-width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
      }
      .composer-actions {
        display: grid;
        gap: 8px;
      }
      .composer-actions .inline {
        min-width: 0;
        max-width: 100%;
      }
      .composer-actions button {
        min-width: 0;
      }
      .sidebar {
        position: fixed !important;
        z-index: 170;
        inset: 0 auto 0 0;
        width: min(88vw, 360px);
        max-width: 360px;
        height: var(--chat-shell-height, var(--chat-viewport-height, 100vh));
        max-height: var(--chat-shell-height, var(--chat-viewport-height, 100vh)) !important;
        display: grid !important;
        grid-template-rows: auto minmax(0, 1fr) auto;
        border-radius: 0 var(--chat-roundness-lg) var(--chat-roundness-lg) 0 !important;
        opacity: 0;
        pointer-events: none;
        transform: translateX(-105%);
        transition: transform .24s ease, opacity .24s ease;
        box-shadow: 24px 0 60px rgba(0,0,0,.42);
      }
      body.mobile-sidebar-open .sidebar {
        opacity: 1 !important;
        pointer-events: auto;
        transform: translateX(0) !important;
      }
      body.chat-sidebar-collapsed .sidebar {
        padding-left: initial;
        padding-right: initial;
        border-width: 1px;
      }
      .sidebar .sidebar-toggle-btn {
        display: inline-grid !important;
        opacity: 1 !important;
        pointer-events: auto !important;
      }
      .sidebar-body {
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
      }
      .mobile-drawer-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 160;
        background: rgba(0,0,0,.50);
        opacity: 0;
        pointer-events: none;
        transition: opacity .24s ease;
      }
      body.mobile-sidebar-open .mobile-drawer-backdrop {
        opacity: 1;
        pointer-events: auto;
      }
      body.mobile-sidebar-open {
        touch-action: none;
      }
      body.mobile-sidebar-open .sidebar,
      body.mobile-sidebar-open .sidebar * {
        touch-action: auto;
      }

      body.chat-room-maximized .mobile-chat-drawer-btn {
        display: none !important;
      }
      body.chat-room-maximized .mobile-drawer-backdrop {
        display: none !important;
        pointer-events: none !important;
        opacity: 0 !important;
      }
    }


    


    html, body {
      overflow: hidden !important;
      overscroll-behavior: none;
    }
    .shell {
      position: fixed !important;
      inset: 0 !important;
      width: 100vw !important;
      height: var(--chat-shell-height, var(--chat-viewport-height, 100vh)) !important;
      min-height: var(--chat-shell-height, var(--chat-viewport-height, 100vh)) !important;
      max-height: var(--chat-shell-height, var(--chat-viewport-height, 100vh)) !important;
    }
    .workspace,
    .chat-pane,
    .chat-body {
      min-height: 0;
    }

    .chat-call-btn {
      min-width: 42px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      border-radius: max(0px, calc(var(--chat-roundness-sm) - 1px));
      background: rgba(65, 211, 145, .12);
      border-color: rgba(65, 211, 145, .28);
      color: var(--text);
      font-weight: 800;
    }
    .chat-call-btn:hover:not(:disabled) { border-color: rgba(65, 211, 145, .62); transform: translateY(-1px); }
    .chat-call-btn:disabled { opacity: .48; cursor: not-allowed; transform: none; }

    .chat-pane {
      position: relative;
      overflow: hidden;
      isolation: isolate;
    }
    .chat-pane > .chat-head,
    .chat-pane > .chat-body,
    .chat-pane > .composer {
      position: relative;
      z-index: 1;
    }
    .chat-pane > .return-current-btn {
      z-index: 2;
    }
    .chat-3d-bg-canvas,
    .chat-3d-bg-frame {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      min-height: 100%;
      max-height: none;
      z-index: 0;
      opacity: .76;
      pointer-events: none;
      display: none;
      border: 0;
      overflow: hidden;
      transform: none !important;
      contain: strict;
    }
    body.chat-3d-bg-active .chat-3d-bg-canvas,
    body.chat-3d-bg-active .chat-3d-bg-frame {
      display: block;
    }
    body.chat-3d-bg-active .chat-body {
      background:
        linear-gradient(180deg, rgba(8, 12, 20, .52), rgba(8, 12, 20, .68)),
        radial-gradient(circle at 18% 0%, rgba(91,140,255,.08), transparent 0 28%);
    }
    .chat-theme3d-btn {
      min-width: 42px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      border-radius: max(0px, calc(var(--chat-roundness-sm) - 1px));
      background: rgba(122, 167, 255, .13);
      border-color: rgba(122, 167, 255, .30);
      color: var(--text);
      font-weight: 800;
    }
    .chat-theme3d-btn:hover:not(:disabled) { border-color: rgba(122, 167, 255, .64); transform: translateY(-1px); }
    .chat-theme3d-btn:disabled { opacity: .48; cursor: not-allowed; transform: none; }
    .chat-theme3d-btn.active {
      background: rgba(139, 92, 246, .18);
      border-color: rgba(196, 181, 253, .48);
      box-shadow: 0 0 0 3px rgba(139, 92, 246, .10);
    }
    .chat-3d-theme-modal-card {
      max-width: min(920px, 94vw);
    }
    .chat-3d-theme-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
      gap: 12px;
      margin-top: 14px;
    }
    .chat-3d-theme-card {
      display: grid;
      gap: 10px;
      text-align: left;
      padding: 12px;
      border: 1px solid var(--line);
      border-radius: 16px;
      background: rgba(255,255,255,.045);
      color: var(--text);
      cursor: pointer;
      min-height: 184px;
    }
    .chat-3d-theme-card:hover,
    .chat-3d-theme-card.active {
      border-color: rgba(122, 167, 255, .46);
      background: rgba(122, 167, 255, .10);
      transform: translateY(-1px);
    }
    .chat-3d-theme-card strong { font-size: .98rem; }
    .chat-3d-theme-preview {
      height: 86px;
      border-radius: 13px;
      overflow: hidden;
      border: 1px solid rgba(255,255,255,.10);
      background:
        radial-gradient(circle at 28% 32%, rgba(255,255,255,.34), transparent 0 8px),
        radial-gradient(circle at 72% 42%, rgba(122,167,255,.48), transparent 0 15px),
        linear-gradient(135deg, rgba(15,23,42,.94), rgba(49,46,129,.68));
      position: relative;
    }
    .chat-3d-theme-preview::after {
      content: '';
      position: absolute;
      inset: auto 10px 12px;
      height: 1px;
      background: linear-gradient(90deg, transparent, rgba(255,255,255,.7), transparent);
      box-shadow: 0 -18px 0 rgba(255,255,255,.16), 0 -36px 0 rgba(255,255,255,.08);
      transform: perspective(140px) rotateX(56deg);
    }
    .chat-3d-theme-preview[data-theme=""] {
      background: linear-gradient(135deg, rgba(15,23,42,.76), rgba(30,41,59,.64));
    }
    .chat-3d-theme-preview[data-theme="webgl_shaders_ocean"] { background: radial-gradient(circle at 62% 25%, rgba(252,211,77,.85), transparent 0 13px), radial-gradient(circle at 44% 56%, rgba(45,212,191,.48), transparent 0 26px), linear-gradient(135deg, #031525, #075985 52%, #0f766e); }
    .chat-3d-theme-preview[data-theme="webgl_shader_lava"] { background: radial-gradient(circle at 48% 48%, rgba(252,211,77,.72), transparent 0 20px), radial-gradient(circle at 36% 34%, rgba(248,113,113,.58), transparent 0 12px), linear-gradient(135deg, #1c0707, #7f1d1d 58%, #111827); }
    .chat-3d-theme-preview[data-theme="webgl_points_waves"] { background: repeating-linear-gradient(172deg, rgba(96,165,250,.42) 0 2px, transparent 2px 12px), linear-gradient(135deg, #06121f, #172554); }
    .chat-3d-theme-preview[data-theme="webgl_points_sprites"] { background: radial-gradient(circle at 28% 32%, rgba(255,255,255,.76), transparent 0 5px), radial-gradient(circle at 70% 38%, rgba(196,181,253,.68), transparent 0 9px), radial-gradient(circle at 52% 70%, rgba(125,211,252,.62), transparent 0 7px), linear-gradient(135deg, #050816, #312e81); }
    .chat-3d-theme-preview[data-theme="webgl_geometry_terrain"] { background: linear-gradient(165deg, transparent 48%, rgba(134,239,172,.40) 49% 52%, transparent 53%), repeating-linear-gradient(20deg, rgba(74,222,128,.30) 0 2px, transparent 2px 16px), linear-gradient(135deg, #06180d, #365314); }
    .chat-3d-theme-preview[data-theme="webgl_marchingcubes"] { background: radial-gradient(circle at 34% 54%, rgba(244,114,182,.62), transparent 0 20px), radial-gradient(circle at 58% 34%, rgba(129,140,248,.58), transparent 0 18px), radial-gradient(circle at 68% 66%, rgba(45,212,191,.50), transparent 0 15px), linear-gradient(135deg, #13051d, #312e81); }
    .chat-3d-theme-preview[data-theme="webgl_materials_cubemap_dynamic"] { background: radial-gradient(circle at 50% 50%, rgba(226,232,240,.65), transparent 0 22px), conic-gradient(from 42deg, #0f172a, #4338ca, #14b8a6, #f59e0b, #0f172a); }
    .chat-3d-theme-preview[data-theme="webgl_buffergeometry_instancing"] { background: radial-gradient(circle at 50% 50%, rgba(125,211,252,.42), transparent 0 22px), repeating-conic-gradient(from 30deg, rgba(167,139,250,.30) 0 12deg, transparent 12deg 30deg), linear-gradient(135deg, #020617, #172554); }
    .chat-3d-theme-preview[data-theme="webgl_gpgpu_birds"] { background: radial-gradient(circle at 28% 24%, rgba(251,191,36,.72), transparent 0 10px), linear-gradient(135deg, #08111f, #1e3a8a 62%, #0f172a); }
    .chat-3d-theme-preview[data-theme="webgl_lights_hemisphere"] { background: radial-gradient(circle at 50% 18%, rgba(186,230,253,.86), transparent 0 18px), linear-gradient(180deg, #075985 0%, #0f172a 52%, #3f2c19 100%); }
    .chat-3d-theme-preview[data-theme="webgl_postprocessing_afterimage"] { background: radial-gradient(circle at 50% 50%, rgba(244,114,182,.48), transparent 0 18px), radial-gradient(circle at 56% 50%, rgba(244,114,182,.26), transparent 0 28px), radial-gradient(circle at 62% 50%, rgba(244,114,182,.16), transparent 0 38px), linear-gradient(135deg, #09090b, #312e81); }
    .chat-3d-theme-preview[data-theme="webgl_lines_fat"] { background: repeating-linear-gradient(155deg, rgba(34,211,238,.60) 0 3px, transparent 3px 17px), repeating-linear-gradient(25deg, rgba(216,180,254,.36) 0 3px, transparent 3px 21px), linear-gradient(135deg, #020617, #1e1b4b); }

    .webstart.servius-chat-media-window .wb-body { overflow: hidden !important; background: #000 !important; }
    .webstart.servius-chat-call-window .wb-body { overflow: hidden !important; background: var(--panel) !important; }
    .chat-call-window {
      min-height: 100%;
      display: grid;
      grid-template-rows: auto minmax(0, 1fr) auto;
      gap: 14px;
      padding: 16px;
      color: var(--text);
      background: radial-gradient(circle at 20% 0%, rgba(65,211,145,.18), transparent 34%), var(--panel);
    }
    .chat-call-window.fallback {
      position: fixed;
      right: 18px;
      bottom: 18px;
      z-index: 9999;
      width: min(720px, calc(100vw - 28px));
      min-height: 420px;
      border: 1px solid var(--line);
      border-radius: 18px;
      box-shadow: var(--shadow);
    }
    .chat-call-peer { display: flex; align-items: center; gap: 12px; min-width: 0; }
    .chat-call-avatar {
      width: 52px; height: 52px; border-radius: 18px;
      display: grid; place-items: center;
      background: linear-gradient(135deg, rgba(84,183,255,.32), rgba(65,211,145,.22));
      border: 1px solid rgba(255,255,255,.12);
      font-size: 1.15rem; font-weight: 900;
      overflow: hidden; flex: 0 0 auto;
    }
    .chat-call-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
    .chat-call-title { min-width: 0; display: grid; gap: 4px; }
    .chat-call-title strong { font-size: 1.08rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .chat-call-title span { color: var(--muted); font-size: .88rem; }

    .chat-call-video-grid {
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(120px, 32%);
      gap: 10px;
      min-height: 190px;
    }
    .chat-call-video-tile {
      position: relative;
      min-width: 0;
      min-height: 150px;
      overflow: hidden;
      border: 1px solid var(--line);
      border-radius: 18px;
      background: rgba(0,0,0,.45);
      display: grid;
      place-items: center;
    }
    .chat-call-video-tile.local { min-height: 120px; }
    .chat-call-video-tile video {
      width: 100%;
      height: 100%;
      min-height: 100%;
      object-fit: cover;
      display: block;
      background: #05070d;
    }
    .chat-call-video-tile.remote video { object-fit: contain; }
    .chat-call-video-tile span {
      position: absolute;
      left: 10px;
      bottom: 8px;
      z-index: 2;
      padding: 4px 8px;
      border-radius: 999px;
      color: #fff;
      background: rgba(0,0,0,.48);
      font-size: .72rem;
      font-weight: 800;
      backdrop-filter: blur(8px);
    }
    .chat-call-video-placeholder {
      position: absolute;
      inset: 0;
      display: grid;
      place-items: center;
      padding: 16px;
      color: rgba(238,244,255,.72);
      text-align: center;
      font-size: .9rem;
      background: radial-gradient(circle at 50% 20%, rgba(65,211,145,.18), transparent 45%), rgba(7,13,24,.78);
    }
    .chat-call-video-placeholder[hidden] { display: none; }
    .chat-call-window.fallback .chat-call-video-grid { min-height: 160px; }
    @media (max-width: 560px) {
      .chat-call-video-grid { grid-template-columns: 1fr; }
      .chat-call-video-tile.local { min-height: 110px; }
    }
    .chat-call-status-card {
      display: grid; place-items: center; text-align: center; gap: 10px;
      border: 1px solid var(--line);
      background: rgba(255,255,255,.045);
      border-radius: 18px;
      padding: 18px;
      min-height: 128px;
    }
    .chat-call-pulse {
      width: 52px; height: 52px; border-radius: 999px;
      border: 2px solid rgba(65,211,145,.58);
      box-shadow: 0 0 0 0 rgba(65,211,145,.38);
      animation: chatCallPulse 1.65s ease-out infinite;
    }
    .chat-call-status-card.ended .chat-call-pulse { border-color: rgba(255,142,142,.58); animation: none; }
    @keyframes chatCallPulse { to { box-shadow: 0 0 0 18px rgba(65,211,145,0); } }
    .chat-call-controls { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
    .chat-call-controls button { min-width: 92px; }
    .chat-call-controls .danger { background: rgba(255, 94, 94, .16); border-color: rgba(255, 94, 94, .42); }
    .chat-call-controls .accept { background: rgba(65, 211, 145, .18); border-color: rgba(65, 211, 145, .5); }
    .chat-call-window audio { width: 100%; display: none; }
    .chat-call-window [data-call-remote-video],
    .chat-call-window [data-call-local-video] { width: 100%; height: 100%; }



    body.chat-video-room-active .chat-body {
      padding: 0;
      overflow: hidden;
      background: radial-gradient(circle at 50% 8%, rgba(91, 140, 255, 0.22), rgba(5, 8, 19, 0.98) 48%, #050813 100%);
    }

    body.chat-video-room-active .composer,
    body.chat-video-room-active #typingIndicator,
    body.chat-video-room-active #chatMessageSearchBar {
      display: none !important;
    }

    .video-room-shell {
      position: relative;
      width: 100%;
      height: 100%;
      min-height: 420px;
      overflow: hidden;
      border-radius: 0;
      background: #050813;
      color: #edf2ff;
      isolation: isolate;
    }

    .video-room-canvas {
      display: block;
      width: 100%;
      height: 100%;
      min-height: inherit;
      cursor: grab;
      outline: none;
      touch-action: none;
    }

    .video-room-canvas:active { cursor: grabbing; }

    .video-room-status {
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      z-index: 3;
      max-width: min(520px, calc(100% - 40px));
      text-align: center;
      padding: 16px 18px;
      border-radius: 20px;
      border: 1px solid rgba(166, 183, 255, 0.24);
      background: rgba(8, 13, 30, 0.82);
      box-shadow: 0 22px 80px rgba(0, 0, 0, 0.34);
      color: #edf2ff;
    }

    .video-room-status[hidden] { display: none !important; }

    .video-room-media-panel {
      position: absolute;
      z-index: 6;
      left: 12px;
      right: 12px;
      top: 12px;
      display: grid;
      gap: 8px;
      max-width: 840px;
      padding: 10px;
      border: 1px solid rgba(166, 183, 255, 0.24);
      border-radius: 16px;
      background: rgba(8, 13, 30, 0.76);
      box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
      backdrop-filter: blur(14px);
    }

    .video-room-media-row {
      display: flex;
      align-items: center;
      gap: 8px;
      min-width: 0;
      flex-wrap: wrap;
    }

    .video-room-media-row.compact {
      gap: 10px;
    }

    .video-room-media-input {
      min-width: 180px;
      flex: 1 1 320px;
      height: 34px;
      padding: 0 10px;
      border-radius: 11px;
      border: 1px solid rgba(166, 183, 255, 0.28);
      background: rgba(3, 7, 18, 0.68);
      color: #edf2ff;
      outline: none;
    }

    .video-room-media-input:focus {
      border-color: rgba(122, 162, 255, 0.76);
      box-shadow: 0 0 0 3px rgba(122, 162, 255, 0.16);
    }

    .video-room-media-btn,
    .video-room-media-upload {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 34px;
      padding: 0 11px;
      border: 1px solid rgba(166, 183, 255, 0.28);
      border-radius: 11px;
      background: rgba(91, 140, 255, 0.18);
      color: #edf2ff;
      font-weight: 800;
      font-size: 0.82rem;
      cursor: pointer;
      user-select: none;
    }

    .video-room-media-btn:hover,
    .video-room-media-upload:hover {
      background: rgba(91, 140, 255, 0.28);
    }

    .video-room-media-btn:disabled {
      opacity: 0.48;
      cursor: not-allowed;
    }

    .video-room-media-upload input {
      display: none;
    }

    .video-room-media-seek {
      flex: 1 1 240px;
      min-width: 160px;
      accent-color: #7aa2ff;
    }

    .video-room-media-time,
    .video-room-media-status {
      color: rgba(237, 242, 255, 0.84);
      font-size: 0.78rem;
      font-weight: 700;
      white-space: nowrap;
    }

    .video-room-media-status {
      color: rgba(198, 211, 255, 0.72);
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 280px;
    }

    .video-room-video-source {
      position: absolute;
      left: -9999px;
      top: -9999px;
      width: 1px;
      height: 1px;
      opacity: 0;
      pointer-events: none;
    }

    @media (max-width: 720px) {
      .video-room-media-panel {
        left: 8px;
        right: 8px;
        top: 8px;
        padding: 8px;
      }
      .video-room-media-input { flex-basis: 100%; }
      .video-room-media-status { max-width: 180px; }
    }


    .room-type-field {
      display: grid;
      gap: 6px;
      align-content: start;
    }

    .room-type-field span {
      color: var(--muted);
      font-size: 0.78rem;
      font-weight: 700;
    }


    




    .shell {
      display: grid !important;
      grid-template-columns: minmax(0, 1fr) !important;
      grid-template-rows: auto minmax(0, 1fr) !important;
      grid-template-areas:
        "chat-topbar"
        "chat-workspace" !important;
      align-items: stretch !important;
      justify-items: stretch !important;
      overflow: hidden !important;
    }
    .shell > .topbar {
      grid-area: chat-topbar !important;
      align-self: stretch !important;
      justify-self: stretch !important;
      min-width: 0 !important;
    }
    .shell > .workspace {
      grid-area: chat-workspace !important;
      align-self: stretch !important;
      justify-self: stretch !important;
      min-width: 0 !important;
      min-height: 0 !important;
      width: 100% !important;
      height: 100% !important;
      max-height: 100% !important;
      overflow: hidden !important;
    }
    .shell > .mobile-switcher {
      display: none !important;
      grid-area: chat-topbar !important;
    }
    .mobile-drawer-backdrop {
      display: none !important;
      position: fixed !important;
      inset: 0 !important;
      z-index: 160;
      background: rgba(0,0,0,.50);
      opacity: 0;
      pointer-events: none;
      transition: opacity .24s ease;
    }
    .floating-sidebar-toggle {
      position: fixed !important;
    }
    @media (min-width: 901px) {
      .shell > :not(.topbar):not(.workspace):not(.floating-sidebar-toggle) {
        position: fixed !important;
      }
      .workspace {
        display: grid !important;
        grid-template-rows: minmax(0, 1fr) !important;
      }
      .rail,
      .sidebar,
      .chat-pane,
      .detail-pane {
        align-self: stretch !important;
        height: 100% !important;
        min-height: 0 !important;
      }
    }
    @media (max-width: 900px) {
      .shell {
        max-width: 100vw !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        transform: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
      }
      .mobile-drawer-backdrop {
        display: block !important;
      }
      body.mobile-sidebar-open .mobile-drawer-backdrop {
        opacity: 1 !important;
        pointer-events: auto !important;
      }
      body.chat-room-maximized .mobile-drawer-backdrop {
        display: none !important;
        opacity: 0 !important;
        pointer-events: none !important;
      }
    }

/* Servius Build 274: keep Ace code-editor fold widgets from inheriting the global Windows button skin. */
body:not(.servius-chat-page) .ace_editor .ace_gutter .ace_fold-widget,
body:not(.servius-chat-page) .ace_editor .ace_gutter .ace_fold-widget[role="button"],
#serviusWebStartRoot .ace_editor .ace_gutter .ace_fold-widget,
#serviusWebStartRoot .ace_editor .ace_gutter .ace_fold-widget[role="button"]{
  min-height:11px!important;
  min-width:11px!important;
  width:11px!important;
  height:11px!important;
  padding:0!important;
  margin:0 -12px 0 1px!important;
  color:#8f969f!important;
  -webkit-text-fill-color:#8f969f!important;
  background:transparent!important;
  background-color:transparent!important;
  background-image:none!important;
  border:0!important;
  border-radius:0!important;
  box-shadow:none!important;
  text-shadow:none!important;
  filter:none!important;
  appearance:auto!important;
  font:11px/11px Arial,Helvetica,sans-serif!important;
  font-weight:400!important;
  cursor:pointer!important;
  transform:none!important;
}
body:not(.servius-chat-page) .ace_editor .ace_gutter .ace_fold-widget:hover,
body:not(.servius-chat-page) .ace_editor .ace_gutter .ace_fold-widget:active,
#serviusWebStartRoot .ace_editor .ace_gutter .ace_fold-widget:hover,
#serviusWebStartRoot .ace_editor .ace_gutter .ace_fold-widget:active{
  color:#b4bbc4!important;
  -webkit-text-fill-color:#b4bbc4!important;
  background:transparent!important;
  background-color:transparent!important;
  background-image:none!important;
  border:0!important;
  box-shadow:none!important;
  transform:none!important;
}
body:not(.servius-chat-page) .ace_editor .ace_gutter .ace_fold-widget::before,
#serviusWebStartRoot .ace_editor .ace_gutter .ace_fold-widget::before{
  display:block!important;
  width:11px!important;
  height:11px!important;
  line-height:10px!important;
  text-align:center!important;
  color:inherit!important;
  -webkit-text-fill-color:inherit!important;
  font:10px/10px Arial,Helvetica,sans-serif!important;
}
body:not(.servius-chat-page) .ace_editor .ace_gutter .ace_fold-widget.ace_open::before,
#serviusWebStartRoot .ace_editor .ace_gutter .ace_fold-widget.ace_open::before{content:"▾"!important;}
body:not(.servius-chat-page) .ace_editor .ace_gutter .ace_fold-widget.ace_closed::before,
#serviusWebStartRoot .ace_editor .ace_gutter .ace_fold-widget.ace_closed::before{content:"▸"!important;}
body:not(.servius-chat-page) .ace_editor .ace_gutter .ace_fold-widget.ace_end::before,
#serviusWebStartRoot .ace_editor .ace_gutter .ace_fold-widget.ace_end::before{content:""!important;}


/* Servius 632: stable context-menu fanouts and translation controls. */
.context-menu-fanout::after {
  content: "";
  position: absolute;
  z-index: 2;
  top: -9px;
  bottom: -9px;
  left: 100%;
  width: 14px;
}
.context-menu[data-fanout-side="left"] .context-menu-fanout::after {
  left: auto;
  right: 100%;
}
.context-menu-translation-settings {
  display: grid;
  gap: 9px;
  padding: 4px 2px 2px;
}
.context-menu-translation-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}
.context-menu-translation-row label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.context-menu-translation-select {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  background: rgba(255,255,255,.06);
  color: var(--text);
  padding: 8px 9px;
  outline: none;
}
.context-menu-translation-select:focus {
  border-color: rgba(142,197,255,.72);
}
.context-menu-inline-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
.context-menu-inline-actions .context-menu-btn {
  flex: 1 1 120px;
}
.auto-translation-note {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .01em;
}

/* Servius 632 patch: non-blocking outgoing auto-translation status. */
.outgoing-auto-translation-status {
  display: flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .01em;
}
.outgoing-auto-translation-status.error {
  opacity: .9;
}
.outgoing-auto-translation-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-width: 22px;
}
.outgoing-auto-translation-dots i {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  animation: servius-outgoing-translation-dot 900ms ease-in-out infinite;
}
.outgoing-auto-translation-dots i:nth-child(2) {
  animation-delay: 120ms;
}
.outgoing-auto-translation-dots i:nth-child(3) {
  animation-delay: 240ms;
}
@keyframes servius-outgoing-translation-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: .45; }
  30% { transform: translateY(-3px); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .outgoing-auto-translation-dots i { animation: none; opacity: .8; }
}
