/* Extracted from chat.html. Loaded in the same position the inline
   <style> occupied, so the cascade is unchanged. */
    .ol-stage { padding-bottom: 28px; }
    .chat-shell {
      display: grid;
      grid-template-columns: 244px minmax(0, 1fr);
      gap: var(--gap);
      height: calc(100vh - 56px);
    }

    .roster { display: flex; flex-direction: column; min-height: 0; padding: 14px; }
    .roster-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding-bottom: 12px;
      border-bottom: 1px solid var(--line);
    }
    .roster-head h1 { font-size: 15px; }
    .dot {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      color: var(--text-faint);
      font-size: 12px;
    }
    .dot::before {
      content: "";
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--text-faint);
    }
    .dot.on::before { background: var(--teal); box-shadow: 0 0 8px var(--teal); }

    .room-btn {
      display: flex;
      align-items: center;
      width: 100%;
      min-height: 40px;
      margin-top: 12px;
      padding: 0 12px;
      border: 1px solid var(--line);
      border-radius: var(--radius-sm);
      background: var(--surface-raised);
      color: var(--text-dim);
      font: inherit;
      font-weight: 600;
      font-size: 14px;
      text-align: left;
      cursor: pointer;
    }
    .room-btn:hover { background: var(--surface-hover); color: var(--text); }
    .room-btn.active { background: var(--accent); border-color: transparent; color: #061019; }

    .roster-label {
      margin: 16px 0 8px;
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: var(--text-faint);
    }
    .members { flex: 1; min-height: 0; overflow-y: auto; display: grid; gap: 6px; align-content: start; }
    .member {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      min-height: 38px;
      padding: 0 6px 0 10px;
      border-radius: var(--radius-sm);
      transition: background 0.14s ease;
    }
    .member:hover { background: var(--surface-raised); }
    .member-name {
      flex: 1;
      min-width: 0;
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 13.5px;
      color: var(--text-dim);
      background: none;
      border: none;
      font-family: inherit;
      text-align: left;
      cursor: pointer;
    }
    /* Only the name itself ellipsizes; the dot and badge keep their size. */
    .member-name > span:not(.dm-dot):not(.badge) {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .member.is-blocked .member-name { color: var(--text-faint); text-decoration: line-through; }
    .member-actions { display: flex; gap: 4px; opacity: 0; flex-shrink: 0; }
    .member:hover .member-actions, .member:focus-within .member-actions { opacity: 1; }

    /* Unread-DM indicator: a small teal dot before the sender's name. */
    .dm-dot {
      flex-shrink: 0;
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: var(--teal);
      box-shadow: 0 0 8px var(--teal);
    }

    /* Rank badges. The server grants these from account membership. */
    .badge {
      flex-shrink: 0;
      padding: 1px 6px;
      border-radius: var(--radius-pill);
      border: 1px solid transparent;
      font-size: 9.5px;
      font-weight: 700;
      letter-spacing: 0.04em;
      text-transform: uppercase;
      line-height: 1.5;
    }
    .badge-owner {
      color: #fbbf24;
      background: rgba(251, 191, 36, 0.14);
      border-color: rgba(251, 191, 36, 0.32);
    }
    .badge-developer {
      color: var(--violet);
      background: rgba(167, 139, 250, 0.14);
      border-color: rgba(167, 139, 250, 0.32);
    }
    .msg-meta .badge { align-self: center; }

    .thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
    .thread-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 14px;
      padding: 15px 18px;
      border-bottom: 1px solid var(--line);
    }
    .thread-head h2 { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .thread-head p { margin-top: 2px; font-size: 12px; color: var(--text-faint); }

    .messages {
      flex: 1;
      min-height: 0;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      gap: 10px;
      padding: 18px;
    }
    .msg {
      width: fit-content;
      max-width: min(660px, 84%);
      padding: 9px 12px;
      border: 1px solid var(--line);
      border-radius: var(--radius-sm);
      background: var(--surface-raised);
      line-height: 1.45;
      font-size: 14px;
    }
    .msg.mine {
      align-self: flex-end;
      background: rgba(125, 211, 252, 0.14);
      border-color: rgba(125, 211, 252, 0.26);
    }
    .msg-meta { display: flex; gap: 8px; margin-bottom: 3px; font-size: 11.5px; color: var(--text-faint); }
    .msg-meta strong { color: var(--text-dim); font-weight: 600; }

    .empty { margin: auto; text-align: center; color: var(--text-faint); font-size: 13.5px; }
    .notice {
      align-self: center;
      padding: 6px 12px;
      border-radius: var(--radius-pill);
      background: rgba(248, 113, 113, 0.1);
      border: 1px solid rgba(248, 113, 113, 0.24);
      color: var(--danger);
      font-size: 12.5px;
    }

    .composer { display: flex; gap: 8px; padding: 14px; border-top: 1px solid var(--line); }

    .join-card { width: min(400px, 100%); margin: 14vh auto 0; padding: 24px; }
    .join-card h1 { font-size: 20px; margin-bottom: 6px; }
    .join-card p { margin-bottom: 18px; }
    .join-grid { display: grid; gap: 9px; }
    .hidden { display: none !important; }

    @media (max-width: 820px) {
      .chat-shell { grid-template-columns: 1fr; height: auto; }
      .roster { max-height: 240px; }
      .thread { height: 68vh; }
    }
  
