/* Chat-first shell. Kept separate from the legacy feature stylesheet so these
   layout rules stay bounded to the authenticated dashboard. */
#app.chat-first-shell {
  --shell-bg: #111216;
  --shell-surface: #191b22;
  --shell-raised: #22252f;
  --shell-border: #333642;
  --shell-text: #f2f3f7;
  --shell-muted: #a7adbb;
  --shell-accent: var(--chat-shell-accent, #8b5cf6);
  --shell-accent-hover: var(--chat-shell-accent-hover, color-mix(in srgb, var(--shell-accent) 82%, white));
  --shell-accent-secondary: var(--chat-shell-accent-secondary, var(--shell-accent));
  --shell-accent-glow: var(--chat-shell-accent-glow, color-mix(in srgb, var(--shell-accent) 35%, transparent));
  --bg-base: var(--shell-bg);
  --bg-panel: var(--shell-surface);
  --bg-panel-solid: var(--shell-surface);
  --bg-input: var(--shell-raised);
  --bg-secondary: var(--shell-surface);
  --bg-tertiary: var(--shell-raised);
  --border-color: var(--shell-border);
  --border-color-hover: color-mix(in srgb, var(--shell-border) 70%, var(--shell-accent));
  --text-primary: var(--shell-text);
  --text-secondary: var(--shell-muted);
  --accent-primary: var(--shell-accent);
  --accent-primary-hover: var(--shell-accent-hover);
  --accent-secondary: var(--shell-accent-secondary);
  --accent-glow: var(--shell-accent-glow);
  width: 100%;
  height: var(--chatdoo-app-height, 100dvh);
  min-height: 0;
  overflow: hidden;
  color: var(--text-primary, var(--shell-text));
  background: var(--shell-bg);
  box-sizing: border-box;
}

body.light-theme #app.chat-first-shell {
  --shell-bg: #f4f5f8;
  --shell-surface: #fff;
  --shell-raised: #f1f2f6;
  --shell-border: #dfe1e8;
  --shell-text: #20222a;
  --shell-muted: #666c79;
}

#app.chat-first-shell *,
#app.chat-first-shell *::before,
#app.chat-first-shell *::after { box-sizing: border-box; }

#app.chat-first-shell #screen-dashboard {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 12px;
  overflow: hidden;
}

#app.chat-first-shell .app-header {
  position: relative;
  z-index: 100;
  display: flex;
  flex-flow: row nowrap;
  flex: 0 0 64px;
  align-items: center;
  gap: 12px;
  height: 64px;
  min-height: 64px;
  padding: 0 12px;
  overflow: visible;
  border: 1px solid var(--shell-border);
  border-radius: 12px;
  background: var(--bg-panel-solid, var(--shell-surface));
  color: var(--text-primary, var(--shell-text));
  box-shadow: 0 8px 28px rgba(0, 0, 0, .18);
}

#app.chat-first-shell .header-brand {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

#app.chat-first-shell #btn-toggle-sidebar,
#app.chat-first-shell .header-controls > button,
#app.chat-first-shell .header-action-slot > button,
#app.chat-first-shell .room-only-control-group > button {
  flex: 0 0 44px;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 12px;
}

#app.chat-first-shell #btn-toggle-sidebar {
  display: none;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--shell-border);
  background: transparent;
  color: inherit;
  font-size: 1.1rem;
  cursor: pointer;
}

#app.chat-first-shell .room-identity {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
}

#app.chat-first-shell .room-title-display {
  display: block;
  min-width: 0;
  overflow: hidden;
  padding: 0;
  border: 0;
  color: var(--text-primary, var(--shell-text));
  font-size: .98rem;
  font-weight: 650;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#app.chat-first-shell .room-header-subtitle {
  display: block;
  min-height: 1em;
  overflow: hidden;
  color: var(--shell-muted);
  font-size: .72rem;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#app.chat-first-shell .workspace-view-title {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--text-primary, var(--shell-text));
  font-size: .98rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#app.chat-first-shell .header-controls {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

#app.chat-first-shell .header-action-slot {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

#app.chat-first-shell .header-action-slot > button,
#app.chat-first-shell #btn-settings-toggle,
#app.chat-first-shell #btn-workspace-overflow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--shell-border);
  background: var(--shell-raised);
  color: var(--text-primary, var(--shell-text));
  cursor: pointer;
}

#app.chat-first-shell #header-invite-slot #btn-share-room {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 84px;
  max-width: 124px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--shell-accent) 55%, var(--shell-border));
  background: color-mix(in srgb, var(--shell-accent) 16%, var(--shell-surface));
  color: var(--text-primary, var(--shell-text));
  white-space: nowrap;
}

#app.chat-first-shell #btn-workspace-overflow {
  flex: 0 0 44px;
  width: 44px;
  min-width: 44px;
  height: 44px;
  border: 1px solid var(--shell-border);
  border-radius: 12px;
  background: var(--shell-raised);
  color: var(--text-primary, var(--shell-text));
  font-size: 1.1rem;
  letter-spacing: .12em;
  cursor: pointer;
}

#app.chat-first-shell .workspace-overflow-menu {
  position: absolute;
  z-index: 1200;
  top: calc(100% + 8px);
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(320px, calc(100vw - 24px));
  max-height: min(70vh, 540px);
  padding: 10px;
  overflow: auto;
  border: 1px solid var(--shell-border);
  border-radius: 14px;
  background: var(--bg-panel-solid, var(--shell-surface));
  box-shadow: 0 18px 48px rgba(0, 0, 0, .34);
}

#app.chat-first-shell .room-only-control-group,
#app.chat-first-shell .workspace-global-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

#app.chat-first-shell .room-only-control-group > button,
#app.chat-first-shell #workspace-global-actions > button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--shell-border);
  border-radius: 10px;
  background: var(--shell-raised);
  color: var(--text-primary, var(--shell-text));
  text-align: left;
  cursor: pointer;
}

#app.chat-first-shell #workspace-global-actions { padding-top: 8px; border-top: 1px solid var(--shell-border); }
#app.chat-first-shell .room-view-segment-control { display: flex !important; flex: 0 0 auto; gap: 4px !important; padding: 3px !important; border-radius: 10px !important; }
#app.chat-first-shell .room-view-segment-control .segment-btn { flex: 1 1 0; min-height: 40px; color: var(--text-primary, var(--shell-text)) !important; }
#app.chat-first-shell .room-view-segment-control .segment-btn.active { background: var(--shell-accent) !important; color: #fff !important; }

#app.chat-first-shell .header-room-presence {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 4px 8px;
  border-radius: 10px;
  background: var(--shell-raised);
  color: var(--shell-muted);
  font-size: .78rem;
}

#app.chat-first-shell .header-room-presence .active-users-count { white-space: nowrap; }
#app.chat-first-shell .presence-avatars-row { display: flex; align-items: center; padding-left: 4px; }
#app.chat-first-shell .presence-mini-avatar { width: 24px; height: 24px; border: 2px solid var(--shell-surface); }
#app.chat-first-shell .presence-bot-count { color: var(--shell-accent); }

#app.chat-first-shell .room-only-control-group .activity-summary {
  max-width: 100%;
  margin: 0;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: .72rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

#app.chat-first-shell #talk-now-open {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  margin: 8px 0;
  padding: 0 12px;
  border: 1px solid var(--shell-border);
  border-radius: 10px;
  background: var(--shell-raised);
  color: var(--text-primary, var(--shell-text));
  text-align: left;
  cursor: pointer;
}
#app.chat-first-shell #talk-now-open[aria-current="page"] {
  border-color: color-mix(in srgb, var(--shell-accent) 65%, var(--shell-border));
  background: color-mix(in srgb, var(--shell-accent) 20%, var(--shell-surface));
}

#app.chat-first-shell .find-people-modal-content {
  width: min(520px, calc(100vw - 24px));
  max-height: min(88dvh, 720px);
  overflow: auto;
}
#app.chat-first-shell .find-people-description { color: var(--shell-muted); }
#app.chat-first-shell #find-people-suggestions-mount,
#app.chat-first-shell .find-people-destinations {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
#app.chat-first-shell #find-people-suggestions-mount .talk-now-panel {
  max-width: 100%;
  max-height: 42vh;
  margin: 0;
  overflow: auto;
}
#app.chat-first-shell .find-people-destinations > * { max-width: 100%; }
#app.chat-first-shell .find-people-browse-everyone { width: 100%; min-height: 44px; margin-top: 12px; }

#app.chat-first-shell .empty-room-starters {
  max-width: 100%;
  margin: 8px auto;
  padding: 10px;
}
#app.chat-first-shell .empty-room-starters-title { margin: 0 0 4px; font-size: .9rem; }
#app.chat-first-shell .empty-room-starters-subtitle { margin: 0 0 8px; font-size: .78rem; }
#app.chat-first-shell .empty-room-starters button { min-height: 40px; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }

#app.chat-first-shell .msg-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
}
#app.chat-first-shell .msg-bubble-wrap.msg-grouped .msg-header { display: none; }
#app.chat-first-shell .msg-body { position: relative; min-width: 0; min-height: 44px; padding-inline-end: 50px; }
#app.chat-first-shell .msg-from-bot.msg-grouped .msg-body { margin-left: 0; }
#app.chat-first-shell .msg-more-actions-btn {
  position: absolute;
  top: 0;
  inset-inline-end: 0;
  z-index: 4;
  display: inline-flex;
  flex: 0 0 44px;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  margin-left: auto;
  padding: 0;
  border: 1px solid var(--shell-border);
  border-radius: 12px;
  background: var(--shell-raised);
  color: var(--text-primary, var(--shell-text));
  font-size: 1.35rem;
  cursor: pointer;
}
#app.chat-first-shell .msg-actions-list { max-height: min(70dvh, 600px); overflow-y: auto; }
#app.chat-first-shell .msg-action-item,
#app.chat-first-shell .msg-action-emoji-btn { min-height: 44px; }
#app.chat-first-shell .msg-action-item { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
#app.chat-first-shell .msg-bubble-wrap,
#app.chat-first-shell .msg-body,
#app.chat-first-shell .msg-content-box { min-width: 0; max-width: 100%; }
#app.chat-first-shell .msg-content-box { overflow-wrap: anywhere; }

#app.chat-first-shell #chat-search-input {
  position: absolute;
  z-index: 1210;
  top: calc(100% + 8px);
  right: 52px;
  width: min(280px, calc(100vw - 32px));
  min-height: 44px;
  background: var(--bg-panel-solid, var(--shell-surface));
  color: var(--text-primary, var(--shell-text));
}

#app.chat-first-shell #search-results-popover {
  position: absolute;
  z-index: 1211;
  top: calc(100% + 58px);
  right: 0;
  width: min(420px, calc(100vw - 24px));
  max-height: min(68vh, 520px);
  overflow: auto;
  background: var(--bg-panel-solid, var(--shell-surface));
}

#app.chat-first-shell .sidebar-brand-slot { flex: 0 0 auto; min-height: 28px; }
#app.chat-first-shell .sidebar-brand-slot .brand-logo { font-size: 1.35rem; color: var(--text-primary, var(--shell-text)); }

#app.chat-first-shell .dashboard-grid {
  display: grid;
  flex: 1 1 0;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  height: auto;
  min-height: 0;
  overflow: hidden;
}

#app.chat-first-shell .sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 248px;
  min-width: 0;
  min-height: 0;
  padding: 12px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--shell-border);
  border-radius: 12px;
  background: var(--bg-panel-solid, var(--shell-surface));
}

#app.chat-first-shell .sidebar .chatbox-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
  padding: 4px;
  border: 1px solid var(--shell-border);
  border-radius: 11px;
  background: var(--shell-raised);
}

#app.chat-first-shell .sidebar .chatbox-tab {
  min-width: 0;
  min-height: 40px;
  padding: 4px 3px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--shell-muted);
  font-size: .74rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#app.chat-first-shell .sidebar .chatbox-tab.active {
  background: color-mix(in srgb, var(--shell-accent) 20%, var(--shell-surface));
  color: var(--text-primary, var(--shell-text));
}

#app.chat-first-shell .sidebar-profile-card {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--shell-border);
  border-radius: 12px;
  background: var(--shell-raised);
  text-align: left;
}

#app.chat-first-shell .sidebar-profile-card .profile-avatar-container {
  grid-column: 1;
  grid-row: 1;
  width: 40px;
  height: 40px;
  margin: 0;
}

#app.chat-first-shell .sidebar-profile-card .profile-details {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  text-align: left;
}

#app.chat-first-shell .sidebar-profile-card .username-display-wrapper { display: flex; align-items: center; gap: 4px; min-width: 0; margin: 0; }
#app.chat-first-shell .sidebar-profile-card .username-display { display: block; min-width: 0; overflow: hidden; font-size: .86rem; text-overflow: ellipsis; white-space: nowrap; }
#app.chat-first-shell .sidebar-profile-card .status-badge { display: block; max-width: 100%; overflow: hidden; color: var(--shell-muted); font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
#app.chat-first-shell .sidebar-profile-card .btn-icon-inline { flex: 0 0 auto; }

#app.chat-first-shell .sidebar-profile-disclosure { grid-column: 3; grid-row: 1; position: relative; min-width: 0; }
#app.chat-first-shell .sidebar-profile-disclosure > summary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--shell-border);
  border-radius: 10px;
  background: transparent;
  color: var(--text-primary, var(--shell-text));
  cursor: pointer;
  list-style: none;
}
#app.chat-first-shell .sidebar-profile-disclosure > summary::-webkit-details-marker { display: none; }
#app.chat-first-shell .sidebar-profile-disclosure[open] > summary { color: var(--shell-accent); }
#app.chat-first-shell .sidebar-profile-disclosure .profile-actions { display: flex; flex-direction: column; gap: 6px; width: 100%; margin: 8px 0 0; }
#app.chat-first-shell .sidebar-profile-disclosure[open] { grid-column: 1 / -1; grid-row: 2; }
#app.chat-first-shell .sidebar-profile-disclosure[open] .profile-actions > div { flex-wrap: wrap; }
#app.chat-first-shell .sidebar-profile-disclosure .user-bio-display { margin-top: 8px; color: var(--shell-muted); font-size: .78rem; overflow-wrap: anywhere; }

#app.chat-first-shell .room-list-tools-header {
  display: grid;
  grid-template-columns: 44px 44px minmax(0, 1fr);
  grid-template-rows: auto 44px;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
#app.chat-first-shell .room-list-tools-header > .section-title {
  grid-column: 1 / -1;
  grid-row: 1;
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}
#app.chat-first-shell #btn-global-search,
#app.chat-first-shell #btn-sidebar-join-room {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
}
#app.chat-first-shell #btn-global-search { grid-column: 1; grid-row: 2; }
#app.chat-first-shell #btn-sidebar-join-room { grid-column: 2; grid-row: 2; }
#app.chat-first-shell .room-list-tools-header > .room-list-tools-toggle {
  grid-column: 3;
  grid-row: 2;
  width: 100%;
  min-width: 0;
  max-width: none;
  height: 44px;
  min-height: 44px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#app.chat-first-shell .chat-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--shell-border);
  border-radius: 12px;
  background: var(--bg-panel-solid, var(--shell-surface));
}

#app.chat-first-shell .chat-pane > .chatbox-tabs { display: none !important; }
#app.chat-first-shell #chat-lobby,
#app.chat-first-shell #wall-lobby,
#app.chat-first-shell #rooms-section,
#app.chat-first-shell #browse-section,
#app.chat-first-shell #games-section,
#app.chat-first-shell #chat-active {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
}

#app.chat-first-shell #chat-active { display: flex; flex-direction: column; overflow: hidden; }
#app.chat-first-shell #messages-stream,
#app.chat-first-shell #wall-timeline-container { flex: 1 1 0; min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
#app.chat-first-shell #messages-stream { padding: 20px; }
#app.chat-first-shell .chat-input-footer { flex: 0 0 auto; min-height: 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); gap: 6px; border-top: 1px solid var(--shell-border); background: var(--shell-surface); }
#app.chat-first-shell #chat-input-bar { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; width: 100%; min-width: 0; max-width: 100%; }
#app.chat-first-shell #chat-input-bar .input-action-group-left { position: relative; flex: 0 0 44px; min-width: 44px; }
#app.chat-first-shell #btn-toggle-attachments { width: 44px !important; height: 44px !important; padding: 0 !important; border-radius: 12px !important; }
#app.chat-first-shell #vf-text-compose { display: flex; flex: 1 1 auto; align-items: center; gap: 0; min-width: 0; }
#app.chat-first-shell #vf-text-compose .input-msg-wrapper { display: flex; flex: 1 1 0; align-items: center; width: auto; min-width: 0; }
#app.chat-first-shell #chat-message-input { display: block; flex: 1 1 auto; width: 100% !important; min-width: 0; min-height: 44px; max-height: 100px; field-sizing: fixed; padding: 10px 14px; resize: none; overflow-y: auto; border: 1px solid var(--shell-border); border-radius: 14px; background: var(--bg-input, var(--shell-raised)); color: var(--text-primary, var(--shell-text)); line-height: 1.35; }
#app.chat-first-shell #chat-message-input { field-sizing: fixed !important; }
#app.chat-first-shell .activity-summary { margin: 4px 12px; background: var(--shell-raised); color: var(--shell-muted); }
#app.chat-first-shell .format-toolbar,
#app.chat-first-shell .format-preview { max-width: min(300px, calc(100vw - 24px)); }
#app.chat-first-shell #btn-send-message { display: inline-flex; flex: 0 0 44px; align-items: center; justify-content: center; width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 0; border: 1px solid color-mix(in srgb, var(--shell-accent) 50%, var(--shell-border)); border-radius: 12px; background: var(--shell-accent); color: #fff; box-shadow: none; }
#app.chat-first-shell #btn-send-message:hover { transform: translateY(-1px); }
#app.chat-first-shell #btn-send-message .vf-mic-icon { font-size: 1.05rem; }
#app.chat-first-shell #btn-send-message .vf-mic-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
#app.chat-first-shell #inline-recording-overlay { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; min-width: 0; border-radius: 14px; background: var(--shell-raised); }
#app.chat-first-shell #inline-recording-overlay.hidden { display: none !important; }
#app.chat-first-shell .attachments-flyout { z-index: 1300; width: min(300px, calc(100vw - 24px)); max-height: 56vh; overflow: auto; border: 1px solid var(--shell-border); background: var(--bg-panel-solid, var(--shell-surface)); }
#app.chat-first-shell #compose-format-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-bottom: 1px solid var(--shell-border); }
#app.chat-first-shell #compose-format-toolbar .fmt-toolbar-btn,
#app.chat-first-shell #attachments-flyout #btn-create-poll,
#app.chat-first-shell #attachments-flyout #btn-emoji-insert,
#app.chat-first-shell #attachments-flyout #btn-speech-to-text,
#app.chat-first-shell #attachments-flyout #btn-schedule-send { flex: 0 0 40px; width: 40px; min-width: 40px; height: 40px; min-height: 40px; }

#app.chat-first-shell .sidebar-backdrop { display: none; }
#app.chat-first-shell .sidebar-backdrop.active { display: block; position: fixed; z-index: 110; inset: 0; background: rgba(4, 6, 12, .5); }

body.focus-mode #app.chat-first-shell .dashboard-grid,
body.chat-fullscreen #app.chat-first-shell .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
body.focus-mode #app.chat-first-shell .sidebar,
body.chat-fullscreen #app.chat-first-shell .sidebar { display: none !important; }

@media (max-width: 768px) {
  #app.chat-first-shell #screen-dashboard { gap: 0; padding: 0; }
  #app.chat-first-shell .app-header {
    flex-flow: row nowrap;
    flex-wrap: nowrap;
    justify-content: flex-start;
    flex-basis: calc(56px + env(safe-area-inset-top, 0px));
    height: calc(56px + env(safe-area-inset-top, 0px));
    min-height: calc(56px + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 8px 0;
    border: 0;
    border-bottom: 1px solid var(--shell-border);
    border-radius: 0;
  }
  #app.chat-first-shell .header-controls { gap: 5px; }
  #app.chat-first-shell #btn-toggle-sidebar { display: inline-flex; }
  #app.chat-first-shell .header-action-slot { gap: 4px; }
  #app.chat-first-shell #header-members-slot,
  #app.chat-first-shell #header-search-slot { display: none; }
  #app.chat-first-shell .header-action-slot > button,
  #app.chat-first-shell #btn-settings-toggle,
  #app.chat-first-shell #btn-workspace-overflow { width: 44px; min-width: 44px; }
  #app.chat-first-shell #header-invite-slot #btn-share-room { min-width: 76px; max-width: 96px; padding: 0 8px; font-size: .78rem; }
  #app.chat-first-shell .dashboard-grid { display: block; position: relative; width: 100%; height: auto; min-height: 0; }
  #app.chat-first-shell .sidebar {
    position: fixed;
    z-index: 120;
    top: calc(56px + env(safe-area-inset-top, 0px));
    bottom: 0;
    left: 0;
    width: min(320px, 88vw);
    max-width: 88vw;
    height: auto;
    border-radius: 0 14px 14px 0;
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: 16px 0 36px rgba(0, 0, 0, .3);
  }
  #app.chat-first-shell .sidebar.active { transform: translateX(0); }
  #app.chat-first-shell .chat-pane { width: 100%; height: 100%; border: 0; border-radius: 0; }
  #app.chat-first-shell #messages-stream { padding: 12px; }
  #app.chat-first-shell .chat-input-footer { padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px)); }
  #app.chat-first-shell .workspace-overflow-menu { width: min(320px, calc(100vw - 16px)); max-height: min(72vh, 560px); }
  #app.chat-first-shell #search-results-popover { right: -2px; width: calc(100vw - 16px); }
  #app.chat-first-shell .room-identity { flex-basis: 0; }
  #app.chat-first-shell .workspace-view-title { flex: 1 1 auto; }
}

@media (max-width: 380px) {
  #app.chat-first-shell .app-header { gap: 5px; padding-right: 5px; padding-left: 5px; }
  #app.chat-first-shell .header-brand { gap: 5px; }
  #app.chat-first-shell .header-controls { gap: 4px; }
  #app.chat-first-shell #header-invite-slot #btn-share-room { min-width: 70px; max-width: 82px; padding: 0 5px; font-size: .73rem; }
}

@media (prefers-reduced-motion: reduce) {
  #app.chat-first-shell .sidebar { transition: none; }
}
