/* ── Content column (Slack-style max-width for readability) ── */
.chat-wrapper[data-controller="room"] #messages > *,
.chat-wrapper[data-controller="room"] .room-typing-bar {
  width: 100%;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}
.chat-wrapper[data-controller="room"] #messages {
  gap: 0;
}
.chat-wrapper[data-controller="room"] #chat-input-area {
  padding-left: 0;
  padding-right: 0;
}

/* ── Room-scoped overrides ── */
.chat-wrapper[data-controller="room"] .user-avatar-fallback {
  background: var(--color-room, #4B35C2);
}
.chat-wrapper[data-controller="room"] #input-container:focus-within {
  border-color: rgba(75,53,194,0.3);
  box-shadow: 0 0 0 3px rgba(75,53,194,0.06);
}
.chat-wrapper[data-controller="room"] #chat-input-area #send-btn {
  background: var(--color-room, #4B35C2);
}
.chat-wrapper[data-controller="room"] #chat-input-area #send-btn:hover {
  background: var(--color-room-hover, #332389);
}

/* ── Room header ── */
.room-header {
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.room-header-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

/* ── Room title flyover trigger ── */
.room-title-wrapper { position: relative; }
.room-title-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  transition: background 0.12s;
}
.room-title-trigger:hover { background: rgba(0,0,0,0.04); }
.room-title-trigger.open { background: rgba(0,0,0,0.04); }
.room-title-hash {
  color: var(--color-room, #4B35C2);
  opacity: 0.5;
  font-size: 15px;
  font-weight: 600;
}
.room-title-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-primary, #1c1917);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40vw;
}
.room-title-trigger .room-member-count {
  font-size: 12px;
  color: var(--color-text-muted, #79716b);
  white-space: nowrap;
}
.room-title-avatars {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
}
.room-title-avatars .room-avatar {
  width: 22px;
  height: 22px;
  border: 2px solid var(--color-surface);
  margin-left: -6px;
}
.room-title-avatars .room-avatar:first-child { margin-left: 0; }
.room-title-chevron {
  opacity: 0;
  transition: opacity 0.15s, transform 0.2s;
  flex-shrink: 0;
}
.room-title-trigger:hover .room-title-chevron,
.room-title-trigger.open .room-title-chevron { opacity: 0.5; }
.room-title-trigger.open .room-title-chevron { transform: rotate(180deg); }

/* ── Room title flyover menu ── */
.room-title-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  margin-top: 6px;
  background: #fff;
  border-radius: 12px;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.04),
    0 2px 4px rgba(0,0,0,0.04),
    0 8px 24px rgba(0,0,0,0.1),
    0 24px 48px rgba(0,0,0,0.06);
  z-index: var(--z-dropdown, 100);
  padding: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-50%) translateY(-8px) scale(0.97);
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.2s;
}
.room-title-menu.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0) scale(1);
}

/* ── 3-column layout ── */
.rm-columns {
  display: flex;
  min-width: 620px;
}
.rm-col {
  padding: 12px 0;
}
.rm-col + .rm-col {
  border-left: 1px solid rgba(0,0,0,0.06);
}
.rm-col-context {
  flex: 1;
  min-width: 180px;
}
.rm-col-members {
  flex: 1.2;
  min-width: 200px;
}
.rm-col-integrations {
  flex: 1.2;
  min-width: 200px;
}
.rm-col-label {
  padding: 0 14px 8px;
  font-size: 10px;
  font-weight: 500;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.rm-col-label-room {
  text-transform: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-primary, #1c1917);
  letter-spacing: 0;
}
.rm-col-hash {
  color: var(--color-room, #4B35C2);
  opacity: 0.5;
  margin-right: 1px;
}
.rm-col-count {
  font-size: 10px;
  font-weight: 600;
  color: #999;
  background: rgba(0,0,0,0.05);
  border-radius: 8px;
  padding: 0 5px;
  line-height: 16px;
}
.rm-section { padding: 2px 6px; }
.rm-section .dropdown-menu-item { font-size: 13px; }
.rm-section .dropdown-divider { margin: 4px 8px; }

/* ── Context column ── */
.rm-rename-input { padding: 4px 8px; }
.rm-rename-input input {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.12s;
}
.rm-rename-input input:focus { border-color: var(--color-brand, #144629); }
.rm-rename-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 6px;
}
.rm-rename-cancel, .rm-rename-save {
  border: none;
  border-radius: 5px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.1s;
}
.rm-rename-cancel {
  background: none;
  color: #999;
}
.rm-rename-cancel:hover { background: rgba(0,0,0,0.04); color: #555; }
.rm-rename-save {
  background: var(--color-brand, #144629);
  color: #fff;
}
.rm-rename-save:hover { opacity: 0.9; }
.rm-purpose-label {
  font-size: 10px;
  font-weight: 500;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 10px 2px;
}
.rm-purpose-text {
  font-size: 12px;
  color: #666;
  padding: 0 10px 4px;
  line-height: 1.4;
}
.rm-purpose-editable {
  cursor: pointer;
  border-radius: 4px;
  padding: 2px 10px;
  margin: 0 -2px;
  transition: background 0.12s;
}
.rm-purpose-editable:hover { background: rgba(0,0,0,0.04); }
.rm-purpose-edit { padding: 0 8px 4px; }
.rm-purpose-input {
  width: 100%;
  border: 1px solid var(--color-border, #e7e5e4);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  font-family: inherit;
  line-height: 1.4;
  resize: none;
  outline: none;
  box-sizing: border-box;
  background: transparent;
  color: inherit;
  transition: border-color 0.15s;
}
.rm-purpose-input:focus { border-color: var(--color-room, #4B35C2); }
.rm-meta-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 10px;
  font-size: 12px;
}
.rm-meta-label { color: #999; }
.rm-meta-value { color: #555; font-weight: 500; font-variant-numeric: tabular-nums; }

/* ── Members column ── */
.rm-member-list {
  max-height: 220px;
  overflow-y: auto;
  padding: 0 6px;
}
.rm-member {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  transition: background 0.1s;
}
.rm-member:hover { background: rgba(0,0,0,0.03); }
.rm-member-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.rm-member-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-room, #4B35C2);
  color: white;
  font-size: 11px;
  font-weight: 600;
}
.rm-member-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.rm-member-name {
  font-size: 13px;
  font-weight: 500;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rm-member-role {
  font-size: 11px;
  color: #999;
}
.rm-member-remove {
  opacity: 0;
  border: none;
  background: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  color: #999;
  transition: opacity 0.1s, color 0.1s, background 0.1s;
}
.rm-member:hover .rm-member-remove { opacity: 1; }
.rm-member-remove:hover { color: #dc2626; background: rgba(220,38,38,0.08); }

/* ── Usage toggle (inline in context column) ── */
.rm-usage-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 5px 8px;
  border: none;
  background: none;
  border-radius: 6px;
  font-size: 13px;
  color: #666;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.rm-usage-toggle:hover { background: rgba(0,0,0,0.04); color: #333; }
.rm-usage-toggle svg:first-child { opacity: 0.5; flex-shrink: 0; }
.rm-usage-toggle-chevron {
  margin-left: auto;
  opacity: 0.3;
  transition: transform 0.15s;
  flex-shrink: 0;
}
.rm-usage-toggle.open .rm-usage-toggle-chevron { transform: rotate(90deg); opacity: 0.5; }
.rm-usage-inline {
  padding: 4px 10px 2px;
}
.rm-usage-loading { font-size: 12px; color: #aaa; }
.rm-usage-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-size: 12px;
  color: #666;
}
.rm-usage-value {
  font-weight: 500;
  color: #333;
  font-variant-numeric: tabular-nums;
}
.rm-usage-total {
  display: flex;
  justify-content: space-between;
  padding: 5px 0 2px;
  margin-top: 3px;
  border-top: 1px solid rgba(0,0,0,0.06);
  font-size: 12px;
  font-weight: 600;
  color: #333;
}
.rm-usage-empty {
  font-size: 12px;
  color: #bbb;
  font-style: italic;
}

/* ── Integrations column ── */
.rm-integrations-body { padding: 0 6px; }
.rm-integrations-loading { font-size: 12px; color: #aaa; padding: 0 8px; }
.rm-int-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  transition: background 0.1s;
}
.rm-int-item:hover { background: rgba(0,0,0,0.03); }
.rm-int-pending { background: rgba(255,180,0,0.04); }
.rm-int-pending:hover { background: rgba(255,180,0,0.08); }
.rm-int-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f4f4f4;
  border-radius: 6px;
  flex-shrink: 0;
}
.rm-int-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}
.rm-int-name {
  font-size: 13px;
  font-weight: 500;
  color: #333;
}
.rm-int-email {
  font-size: 11px;
  color: #888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rm-int-meta {
  font-size: 11px;
  color: #999;
}
.rm-int-status {
  font-weight: 500;
}
.rm-int-status-active { color: #16a34a; }
.rm-int-status-error { color: #dc2626; }
.rm-int-status-pending { color: #d97706; }
.rm-int-status-action { color: #4B35C2; font-weight: 600; }
.rm-int-scope {
  font-size: 10px;
  font-weight: 500;
  background: rgba(75,53,194,0.08);
  color: var(--color-room, #4B35C2);
  padding: 0 4px;
  border-radius: 3px;
}
.rm-int-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px 14px;
  text-align: center;
}
.rm-int-empty svg { color: #ccc; }
.rm-int-empty > span:first-of-type {
  font-size: 12px;
  color: #999;
  font-weight: 500;
}
.rm-int-hint {
  font-size: 11px;
  color: #bbb;
  line-height: 1.4;
}
.rm-int-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.rm-int-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 14px;
  background: #fff;
  font-size: 11px;
  font-weight: 500;
  color: #555;
  cursor: pointer;
  transition: background 0.1s, border-color 0.15s, color 0.1s;
}
.rm-int-chip:hover {
  background: rgba(75,53,194,0.04);
  border-color: rgba(75,53,194,0.2);
  color: #333;
}
.rm-int-chip svg { width: 13px; height: 13px; flex-shrink: 0; }
.rm-int-chip-other { border-style: dashed; color: #999; font-weight: 400; }
.rm-int-lock { margin-bottom: 6px; font-size: 11px; }

/* ── Room connection connect/granted states ── */
.room-conn-connecting {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #888;
  padding: 6px 12px;
}
.room-conn-connecting .status-typing { margin: 0; }
.room-conn-granted-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.room-conn-granted-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-room, #4B35C2);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
}
.room-conn-granted-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}
/* Room-scoped connect prompt: "shared" badge to distinguish from personal */
.chat-wrapper[data-controller="room"] .google-auth-prompt-inner strong::after {
  content: "shared";
  display: inline-block;
  margin-left: 6px;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-room, #4B35C2);
  background: rgba(75,53,194,0.08);
  padding: 1px 5px;
  border-radius: 4px;
  vertical-align: middle;
  position: relative;
  top: -0.5px;
}
.chat-wrapper[data-controller="room"] .google-auth-prompt-inner.connected strong::after {
  content: none;
}
.google-auth-btn-area {
  flex-shrink: 0;
}
.room-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-primary, #1c1917);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.room-name-hash {
  color: var(--color-room, #4B35C2);
  opacity: 0.5;
  margin-right: 1px;
}
.room-member-count {
  font-size: 12px;
  color: var(--color-text-muted, #79716b);
  white-space: nowrap;
}

/* ── Presence bar ── */
.room-presence-bar {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
}
.room-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--color-surface);
  margin-left: -6px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.room-avatar:first-child { margin-left: 0; }
.room-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
.room-avatar-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-room, #4B35C2);
  color: white;
  font-size: 11px;
  font-weight: 600;
  border-radius: 50%;
}
.room-avatar-overflow {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--color-surface);
  margin-left: -6px;
  background: #e7e5e4;
  color: #78716c;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Header actions ── */
.room-header-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.room-invite-btn, .room-delete-btn, .room-leave-btn {
  background: none;
  border: none;
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  color: #78716c;
  transition: background 0.12s, color 0.12s;
}
.room-invite-btn:hover { background: rgba(75,53,194,0.08); color: var(--color-room, #4B35C2); }
.room-delete-btn:hover { background: rgba(220,38,38,0.08); color: #dc2626; }
.room-leave-btn:hover { background: rgba(220,38,38,0.08); color: #dc2626; }

/* ── Typing bar ── */
.room-typing-bar {
  padding: 4px 24px;
  font-size: 12px;
  color: var(--color-text-muted, #79716b);
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
}
.room-typing-bar .status-typing { transform: scale(0.7); }

/* ── Messages ── */
.room-message {
  padding: 2px 24px;
}
.room-message:not(.consecutive) {
  padding-top: 12px;
}
.room-msg-header {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin-bottom: 1px;
}
.room-msg-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  align-self: center;
  cursor: pointer;
}
.room-msg-avatar-fallback {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-room, #4B35C2);
  color: white;
  font-size: 9px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  align-self: center;
  cursor: pointer;
}
.room-msg-avatar-pine {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  align-self: center;
  cursor: pointer;
}
.room-msg-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-primary, #1c1917);
}
.room-msg-name {
  cursor: pointer;
  border-radius: 4px;
  padding: 0 2px;
  margin: 0 -2px;
}
.room-msg-name:hover {
  background: rgba(0,0,0,0.05);
}
.room-msg-time {
  font-size: 11px;
  color: #a8a29e;
}
.room-msg-body {
  padding-left: 5px;
}
.room-msg-body .content {
  font-size: 14px;
  line-height: 1.5;
  color: #44403c;
}
.room-msg-body .content p {
  margin: 0 0 4px;
}
.room-msg-body .content p:last-child {
  margin-bottom: 0;
}

/* Consecutive messages: tighter spacing, no header */
.room-message.consecutive .room-msg-body {
  padding-left: 5px;
}

/* ── Message actions (comment toggle) ── */
.room-msg-actions {
  padding-left: 5px;
  margin-top: 2px;
  opacity: 0;
  transition: opacity 0.12s;
}
.room-msg-actions.has-comments { opacity: 1; }
.room-message:hover .room-msg-actions { opacity: 1; }
.room-comment-toggle {
  background: none;
  border: none;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  color: #a8a29e;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background 0.12s, color 0.12s;
}
.room-comment-toggle:hover { background: rgba(0,0,0,0.04); color: #57534e; }
.room-comment-count { font-weight: 600; }

/* ── Comments thread ── */
.room-comments-thread {
  padding-left: 5px;
  margin-top: 4px;
  border-left: 2px solid rgba(75,53,194,0.15);
  padding-bottom: 4px;
}
.room-comment {
  padding: 3px 8px;
  font-size: 13px;
}
.room-comment-author {
  font-weight: 600;
  color: var(--color-text-primary, #1c1917);
  margin-right: 6px;
}
.room-comment-text { color: #57534e; }
.room-comment-form {
  display: flex;
  gap: 6px;
  padding: 4px 8px;
}
.room-comment-input {
  flex: 1;
  border: 1px solid #e7e5e4;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
}
.room-comment-input:focus { border-color: var(--color-room, #4B35C2); }
.room-comment-submit {
  background: var(--color-room, #4B35C2);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}

/* ── Tool cards ── */
.room-tool-card {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  margin: 4px 0;
  border-radius: 6px;
  background: rgba(0,0,0,0.03);
  font-size: 12px;
  color: #57534e;
}
.room-tool-icon { display: flex; opacity: 0.5; }
.room-tool-label { font-weight: 500; }
.room-tool-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.room-tool-status.running {
  background: #f59e0b;
  animation: toolPulse 1s ease-in-out infinite;
}
.room-tool-status.success { background: var(--color-brand, #144629); }
.room-tool-status.error { background: #dc2626; }
.room-tool-status.warning { background: #f59e0b; }
@keyframes toolPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Connection approval card ── */
.room-connection-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  margin: 8px 0;
  border-radius: 8px;
  background: rgba(75,53,194,0.04);
  border: 1px solid rgba(75,53,194,0.12);
  animation: secureCardAppear 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.room-connection-card.approved {
  border-color: rgba(75,53,194,0.25);
  background: rgba(75,53,194,0.06);
}
.room-connection-card.denied {
  border-color: rgba(220,38,38,0.15);
  background: rgba(220,38,38,0.03);
}
.room-conn-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(75,53,194,0.1);
  color: var(--color-room, #4B35C2);
}
.room-conn-info {
  flex: 1;
  min-width: 0;
}
.room-conn-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-primary, #1c1917);
}
.room-conn-status {
  display: block;
  font-size: 12px;
  color: #a8a29e;
  margin-top: 2px;
}
.room-connection-card.approved .room-conn-status {
  color: var(--color-room, #4B35C2);
}
.room-connection-card.denied .room-conn-status {
  color: #dc2626;
}
.room-conn-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-self: center;
}
.room-conn-btn {
  padding: 5px 12px;
  border-radius: 6px;
  border: none;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.12s;
}
.room-conn-btn.approve {
  background: var(--color-room, #4B35C2);
  color: white;
}
.room-conn-btn.approve:hover { background: var(--color-room-hover, #3d328a); }
.room-conn-btn.approve-room {
  background: rgba(75,53,194,0.1);
  color: var(--color-room, #4B35C2);
}
.room-conn-btn.approve-room:hover { background: rgba(75,53,194,0.18); }
.room-conn-btn.deny {
  background: rgba(220,38,38,0.08);
  color: #dc2626;
}
.room-conn-btn.deny:hover { background: rgba(220,38,38,0.15); }
.room-conn-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ── Input override: match content column width ── */
.chat-wrapper[data-controller="room"] #chat-input-area form {
  max-width: 900px;
}
.chat-wrapper[data-controller="room"] #input-row {
  align-items: center;
}
.chat-wrapper[data-controller="room"] #chat-input-area textarea,
.chat-wrapper[data-controller="room"] #chat-input-area #send-btn {
  margin-bottom: 0;
}
.chat-wrapper[data-controller="room"] #chat-input-area textarea {
  padding-top: 10px;
  padding-bottom: 4px;
}
.chat-wrapper[data-controller="room"] #chat-input-area #send-btn {
  background: var(--color-room, #4B35C2);
}
.chat-wrapper[data-controller="room"] #chat-input-area #send-btn:hover {
  background: var(--color-room-hover, #332389);
}
.chat-wrapper[data-controller="room"] #chat-input-area #send-btn:disabled {
  background: rgba(180,170,160,0.35);
}
.chat-wrapper[data-controller="room"] #stop-btn {
  background: var(--color-room, #4B35C2);
}

/* ── Room intro banner ── */
.room-intro-banner {
  margin: 16px 24px 8px;
  background: color-mix(in srgb, var(--color-room, #4B35C2) 4%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-room, #4B35C2) 12%, transparent);
  border-radius: 10px;
  padding: 14px 18px;
  animation: secureCardAppear 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.room-intro-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.room-intro-shield {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--color-room, #4B35C2);
}
.room-intro-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-room, #4B35C2);
  letter-spacing: 0.01em;
  flex: 1;
}
.room-intro-dismiss {
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: color-mix(in srgb, var(--color-room, #4B35C2) 30%, var(--color-text-muted, #999));
  cursor: pointer;
  padding: 0 2px;
  transition: color 0.12s;
}
.room-intro-dismiss:hover { color: color-mix(in srgb, var(--color-room, #4B35C2) 40%, var(--color-text-secondary, #666)); }
.room-intro-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.room-intro-row {
  display: flex;
  gap: 10px;
  font-size: 12px;
  line-height: 1.4;
}
.room-intro-label {
  width: 90px;
  flex-shrink: 0;
  font-weight: 600;
  color: color-mix(in srgb, var(--color-room, #4B35C2) 60%, var(--color-text-muted, #999));
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.04em;
  padding-top: 1px;
}
.room-intro-value {
  color: color-mix(in srgb, var(--color-room, #4B35C2) 25%, var(--color-text-secondary, #666));
}

/* ── Empty state / welcome ── */
.room-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 8px;
  padding: 24px;
}
.room-welcome-icon {
  color: var(--color-room, #4B35C2);
  opacity: 0.4;
  margin-bottom: 4px;
}
.room-welcome-text {
  font-size: 15px;
  color: color-mix(in srgb, var(--color-room, #4B35C2) 45%, var(--color-text-muted, #999));
  margin: 0 0 12px;
}
.room-welcome-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 480px;
  min-height: 36px;
  transition: opacity 0.25s ease;
}
.room-welcome-chips.room-chips-fade-out {
  opacity: 0;
}
.room-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 18px;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  background: color-mix(in srgb, var(--color-room, #4B35C2) 8%, transparent);
  border: none;
  color: color-mix(in srgb, var(--color-room, #4B35C2) 80%, var(--color-text-primary, #1a1a1a));
  transition: background 0.15s, box-shadow 0.15s, border-color 0.15s;
  line-height: 1.4;
  text-align: left;
}
.room-chip .chip-label {
  flex: 1;
  min-width: 0;
}
.room-chip:hover {
  background: color-mix(in srgb, var(--color-room, #4B35C2) 15%, transparent);
  box-shadow: 0 1px 4px color-mix(in srgb, var(--color-room, #4B35C2) 12%, transparent);
}
.room-chip.chip-enter {
  opacity: 0;
  transform: translateY(4px) scale(0.96);
  animation: roomChipReveal 0.4s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}
@keyframes roomChipReveal {
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.room-chip.skeleton {
  background: linear-gradient(90deg, color-mix(in srgb, var(--color-room, #4B35C2) 6%, transparent) 25%, color-mix(in srgb, var(--color-room, #4B35C2) 12%, transparent) 50%, color-mix(in srgb, var(--color-room, #4B35C2) 6%, transparent) 75%);
  background-size: 200% 100%;
  animation: roomChipShimmer 2.8s ease-in-out infinite;
  border: none;
  color: transparent;
  min-width: 80px;
  cursor: default;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.room-chip.skeleton.fade-out {
  opacity: 0;
  transform: scale(0.92);
}
@keyframes roomChipShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.room-chip-icon {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  opacity: 0.35;
}
.room-chip:hover .room-chip-icon { opacity: 0.8; }

/* ── Fork/Join icon animation ── */
.fj-icon-animated { color: #555; }
.fj-icon-animated svg { overflow: visible; }
.fj-icon-animated .fj-trunk { stroke-dasharray: 4; stroke-dashoffset: 4; animation: fjDraw 0.4s 0.1s ease forwards; }
.fj-icon-animated .fj-branch-left { stroke-dasharray: 12; stroke-dashoffset: 12; animation: fjDraw 0.5s 0.3s ease forwards; }
.fj-icon-animated .fj-branch-right { stroke-dasharray: 12; stroke-dashoffset: 12; animation: fjDraw 0.5s 0.4s ease forwards; }
.fj-icon-animated .fj-node-root { opacity: 0; animation: fjNodePop 0.3s 0s ease forwards; }
.fj-icon-animated .fj-node-left { opacity: 0; animation: fjNodePop 0.3s 0.7s ease forwards; }
.fj-icon-animated .fj-node-right { opacity: 0; animation: fjNodePop 0.3s 0.8s ease forwards; }
.fj-icon-animated .fj-stem-left { stroke-dasharray: 2; stroke-dashoffset: 2; animation: fjDraw 0.2s 0.6s ease forwards; }
.fj-icon-animated .fj-stem-right { stroke-dasharray: 2; stroke-dashoffset: 2; animation: fjDraw 0.2s 0.7s ease forwards; }
.fork-join-card:not(.complete):not(.warning) .fj-node-left,
.fork-join-card:not(.complete):not(.warning) .fj-node-right {
  animation: fjNodePop 0.3s 0.7s ease forwards, fjNodePulse 1.8s 1s ease-in-out infinite;
}
@keyframes fjDraw { to { stroke-dashoffset: 0; } }
@keyframes fjNodePop { to { opacity: 1; } }
@keyframes fjNodePulse {
  0%, 100% { r: 2; opacity: 1; }
  50% { r: 2.8; opacity: 0.7; }
}

/* ── Fork/Join parallel tasks ── */
.fork-join-card .fj-tasks {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}
.fj-task {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 12.5px;
  color: #555;
  background: rgba(0,0,0,0.025);
  transition: background 0.3s ease;
}
.fj-task.complete { background: rgba(34,139,34,0.06); }
.fj-task.error { background: rgba(220,38,38,0.06); }
.fj-task-icon { width: 14px; height: 14px; flex-shrink: 0; opacity: 0.5; }
.fj-task-icon svg { width: 14px; height: 14px; }
.fj-task-label { flex: 1; }
.fj-task-target { opacity: 0.6; font-style: italic; }
.fj-task-status { flex-shrink: 0; font-size: 11px; }
.fj-task-status .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #bbb;
  animation: pulse 1.5s ease-in-out infinite;
}
.fj-task-status .check { color: #228B22; font-weight: 600; }
.fj-task-status .error-x { color: #dc2626; font-weight: 600; }
.fj-task.complete .fj-task-icon { opacity: 0.7; }
.fj-task.complete .fj-task-label { color: #333; }

/* ── Reply chips (after assistant messages) ── */
.room-reply-chips {
  padding: 6px 24px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Sidebar: new-conv row with room button ── */
.nav-new-row {
  display: flex;
  gap: 3px;
  margin: 15px 0 -5px;
  width: 100%;
  position: relative;
}
.nav-new-row .nav-item-new-conv {
  margin: 0;
  width: auto;
  flex: 1;
}
.nav-item-new-room {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: rgba(139,115,85,0.08);
  color: #a08b6e;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, transform 0.1s ease;
}
.nav-item-new-room:hover { background: rgba(139,115,85,0.13); color: #8b7355; transform: scale(1.015); }
.nav-item-new-room:active { transform: scale(0.97); }
.nav-item-new-room svg { opacity: 0.7; }
.nav-new-more-plus {
  position: absolute;
  top: -4px;
  right: -5px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  color: #a08b6e;
  opacity: 0.8;
}
.nav-item-new-room { position: relative; }
.nav-room-tooltip {
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  transform: translateX(-50%) scale(0.4) translateY(-4px);
  background: #fff;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 8px;
  padding: 6px 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  white-space: nowrap;
  font-size: 12px;
  color: #555;
  pointer-events: none;
  opacity: 0;
  z-index: var(--z-dropdown, 100);
}
.nav-item-new-room:hover .nav-room-tooltip {
  animation: room-tooltip-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes room-tooltip-pop {
  0% { opacity: 0; transform: translateX(-50%) scale(0.4) translateY(-4px); }
  60% { opacity: 1; transform: translateX(-50%) scale(1.03) translateY(0); }
  80% { transform: translateX(-50%) scale(0.98); }
  100% { opacity: 1; transform: translateX(-50%) scale(1); }
}

/* ── Sidebar: room list items ── */
#sidebar-rooms-header {
  padding: 12px 16px 4px;
}
#sidebar-rooms-header h2 {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: #a8a29e;
  letter-spacing: 0.06em;
  margin: 0;
}
#room-list {
  padding: 0 8px 4px;
}
.room-item {
  display: flex;
  align-items: center;
  border-radius: 6px;
  font-size: 13px;
  color: #57534e;
  cursor: pointer;
  transition: background 0.12s;
}
.room-item:hover { background: rgba(0,0,0,0.04); }
.room-item.active { background: rgba(75,53,194,0.08); font-weight: 500; }
.room-item .conv-link {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
  padding: 5px 8px;
}
.room-item-hash {
  flex-shrink: 0;
  color: var(--color-room, #4B35C2);
  opacity: 0.5;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
}
.room-item.active .room-item-hash { opacity: 0.8; }
.room-member-badge {
  flex-shrink: 0;
  font-size: 10px;
  background: rgba(75,53,194,0.1);
  color: var(--color-room, #4B35C2);
  padding: 1px 5px;
  border-radius: 8px;
  font-weight: 600;
}

/* ── Invite modal ── */
.room-invite-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: var(--z-modal, 1000);
  display: flex;
  align-items: center;
  justify-content: center;
}
.room-invite-modal {
  background: white;
  border-radius: 12px;
  padding: 24px;
  width: 360px;
  max-height: 80vh;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  animation: secureCardAppear 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.room-invite-modal h3 {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 600;
}
.room-invite-search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e7e5e4;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  margin-bottom: 12px;
  outline: none;
  box-sizing: border-box;
}
.room-invite-search:focus { border-color: var(--color-room, #4B35C2); }
.room-invite-list {
  max-height: 300px;
  overflow-y: auto;
}
.room-invite-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
}
.room-invite-item:hover { background: rgba(0,0,0,0.03); }
.room-invite-item img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}
.room-invite-item-fallback {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-room, #4B35C2);
  color: white;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.room-invite-item-info { flex: 1; min-width: 0; }
.room-invite-item-name { font-size: 14px; font-weight: 500; display: block; }
.room-invite-item-email { font-size: 12px; color: #a8a29e; display: block; }
.room-invite-item-action {
  padding: 4px 12px;
  border-radius: 6px;
  border: none;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  font-weight: 500;
}
.room-invite-item-action.invite {
  background: var(--color-room, #4B35C2);
  color: white;
}
.room-invite-item-action.invited {
  background: #e7e5e4;
  color: #a8a29e;
  cursor: default;
}
.room-invite-close {
  width: 100%;
  padding: 8px;
  margin-top: 12px;
  background: rgba(0,0,0,0.04);
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s;
}
.room-invite-close:hover { background: rgba(0,0,0,0.08); }

/* ── Room invite animation (sidebar) ── */
@keyframes roomInvitePop {
  0% { transform: scale(0.9); opacity: 0; }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); opacity: 1; }
}
.room-item-enter {
  animation: roomInvitePop 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Create room modal ── */
.room-create-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: var(--z-modal, 1000);
  display: flex;
  align-items: center;
  justify-content: center;
}
.room-create-modal {
  background: white;
  border-radius: 12px;
  padding: 24px;
  width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  animation: secureCardAppear 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.room-create-modal h3 {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 600;
}

/* Modal tabs */
.room-modal-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border-bottom: 1px solid #e7e5e4;
}
.room-modal-tab {
  flex: 1;
  padding: 8px 0;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 500;
  color: #78716c;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.room-modal-tab:hover { color: #1c1917; }
.room-modal-tab.active {
  color: var(--color-room, #4B35C2);
  border-bottom-color: var(--color-room, #4B35C2);
}

/* Browse rooms */
.browse-rooms-list {
  min-height: 120px;
  max-height: 320px;
  overflow-y: auto;
}
.browse-rooms-loading,
.browse-rooms-empty {
  padding: 32px 0;
  text-align: center;
  color: #a8a29e;
  font-size: 14px;
}
.browse-room-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #f5f5f4;
}
.browse-room-item:last-child { border-bottom: none; }
.browse-room-info { display: flex; flex-direction: column; gap: 2px; }
.browse-room-hash {
  color: var(--color-room, #4B35C2);
  font-weight: 700;
  margin-right: 4px;
}
.browse-room-name {
  font-size: 14px;
  font-weight: 500;
  color: #1c1917;
}
.browse-room-meta {
  font-size: 12px;
  color: #a8a29e;
}
.browse-room-join {
  padding: 5px 14px;
  border: 1px solid var(--color-room, #4B35C2);
  border-radius: 6px;
  background: none;
  color: var(--color-room, #4B35C2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.browse-room-join:hover {
  background: var(--color-room, #4B35C2);
  color: white;
}

/* Sidebar browse rooms button */
.sidebar-browse-rooms {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 8px 12px;
  border: 1px dashed #d6d3d1;
  border-radius: 8px;
  background: none;
  color: #78716c;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.sidebar-browse-rooms:hover {
  border-color: var(--color-room, #4B35C2);
  color: var(--color-room, #4B35C2);
}

/* Room visibility toggle */
.room-create-visibility {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #44403c;
  cursor: pointer;
  padding: 8px 0;
  flex-wrap: wrap;
}
.room-create-visibility input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-room, #4B35C2);
  cursor: pointer;
}
.room-lock-icon {
  color: #78716c;
}
.room-create-visibility-hint {
  flex-basis: 100%;
  font-size: 12px;
  color: #a8a29e;
  margin-left: 22px;
}
.room-create-slug-row {
  display: flex;
  align-items: center;
  border: 1px solid #e7e5e4;
  border-radius: 8px;
  padding: 0 12px;
  transition: border-color 0.15s;
}
.room-create-slug-row:focus-within {
  border-color: var(--color-room, #4B35C2);
}
.room-create-hash {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-room, #4B35C2);
  opacity: 0.5;
  margin-right: 2px;
  user-select: none;
}
.room-create-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 10px 0;
  font-size: 15px;
  font-family: inherit;
  background: transparent;
}
.room-create-input::placeholder {
  color: #c4c0bc;
}
.room-create-input.auto-suggested {
  color: #78716c;
  font-style: italic;
}
.room-create-hint {
  font-size: 12px;
  color: #a8a29e;
  margin: 8px 0 0;
}
.room-create-error {
  font-size: 12px;
  color: var(--color-danger, #dc2626);
  margin: 6px 0 0;
}
.room-create-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.room-create-cancel {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: rgba(0,0,0,0.04);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s;
}
.room-create-cancel:hover { background: rgba(0,0,0,0.08); }
.room-create-submit {
  padding: 8px 20px;
  border: none;
  border-radius: 8px;
  background: var(--color-room, #4B35C2);
  color: white;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s, opacity 0.12s;
}
.room-create-submit:hover { background: var(--color-room-hover, #3d328a); }
.room-create-submit:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ── Create room: purpose + suggestion ── */
.room-create-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-primary, #1c1917);
  margin-bottom: 6px;
}
.room-create-label-small {
  font-size: 12px;
  color: var(--color-text-muted, #79716b);
}
.room-create-purpose {
  width: 100%;
  border: 1px solid #e7e5e4;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.4;
  resize: none;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.room-create-purpose::placeholder {
  color: #c4c0bc;
}
.room-create-purpose:focus {
  border-color: var(--color-room, #4B35C2);
}
.room-create-suggestions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  min-height: 98px;
  animation: roomSuggestionAppear 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.room-create-suggestion {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: rgba(75,53,194,0.04);
  border: none;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.12s;
}
.room-create-suggestion:hover {
  background: rgba(75,53,194,0.08);
}
.room-create-suggestion.active {
  background: rgba(75,53,194,0.08);
}
.room-create-suggestion-hash {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-room, #4B35C2);
  opacity: 0.4;
}
.room-create-suggestion-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-room, #4B35C2);
  flex: 1;
}
.room-create-suggestion-use {
  display: none;
}
.room-suggestion-haiku .room-create-suggestion-name::after {
  content: "Suggested";
  font-size: 9px;
  font-weight: 600;
  color: rgba(75,53,194,0.5);
  background: rgba(75,53,194,0.08);
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 6px;
  vertical-align: middle;
}
.room-create-divider {
  height: 1px;
  background: #e7e5e4;
  margin: 14px 0 12px;
}
/* ── Create room: member picker ── */
.room-create-members {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  border: 1px solid #e7e5e4;
  border-radius: 8px;
  padding: 6px 8px;
  min-height: 36px;
  cursor: text;
  transition: border-color 0.15s;
  position: relative;
}
.room-create-members:has(.room-create-member-chip) {
  padding: 4px 6px;
}
.room-create-members:focus-within {
  border-color: var(--color-room, #4B35C2);
}
.room-create-members-selected {
  display: contents;
}
.room-create-member-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px 2px 2px;
  background: rgba(75,53,194,0.08);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-room, #4B35C2);
  white-space: nowrap;
  animation: roomSuggestionAppear 0.15s ease-out;
}
.room-create-member-chip img {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
}
.room-create-member-chip-fallback {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-room, #4B35C2);
  color: white;
  font-size: 9px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.room-create-member-chip-remove {
  background: none;
  border: none;
  padding: 0 2px;
  cursor: pointer;
  color: rgba(75,53,194,0.4);
  font-size: 14px;
  line-height: 1;
  transition: color 0.12s;
}
.room-create-member-chip-remove:hover { color: var(--color-room, #4B35C2); }
.room-create-member-search {
  flex: 1;
  min-width: 80px;
  border: none;
  outline: none;
  padding: 4px 0;
  font-size: 13px;
  font-family: inherit;
  background: transparent;
}
.room-create-member-search::placeholder { color: #c4c0bc; }
.room-create-member-results {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.15s ease;
}
.room-create-member-results.open {
  max-height: 160px;
  overflow-y: auto;
  border: 1px solid #e7e5e4;
  border-radius: 8px;
  margin-top: 4px;
}
.room-create-member-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  cursor: pointer;
  transition: background 0.1s;
}
.room-create-member-item:hover { background: rgba(75,53,194,0.04); }
.room-create-member-item img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.room-create-member-item-fallback {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-room, #4B35C2);
  color: white;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.room-create-member-item-info {
  flex: 1;
  min-width: 0;
}
.room-create-member-item-name {
  font-size: 13px;
  font-weight: 500;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.room-create-member-item-email {
  font-size: 11px;
  color: #a8a29e;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.room-create-member-results-empty {
  padding: 10px;
  text-align: center;
  font-size: 12px;
  color: #a8a29e;
}

@keyframes roomSuggestionAppear {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Mention popover ── */
.mention-popover {
  position: absolute;
  bottom: 100%;
  left: 8px;
  right: 8px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.08);
  padding: 4px;
  z-index: var(--z-dropdown, 100);
  max-height: 200px;
  overflow-y: auto;
  animation: mentionPopoverIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}
.mention-popover-comment {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  margin-bottom: 4px;
}
@keyframes mentionPopoverIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.mention-popover-list {
  display: flex;
  flex-direction: column;
}
.mention-popover-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.mention-popover-item:hover,
.mention-popover-item.active {
  background: rgba(75,53,194,0.08);
}
.mention-popover-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.mention-popover-avatar-fallback {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-room, #4B35C2);
  color: white;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mention-popover-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-primary, #1c1917);
}

/* ── Mention tags in messages ── */
.mention-tag {
  color: var(--color-room, #4B35C2);
  font-weight: 600;
  background: rgba(75,53,194,0.08);
  padding: 1px 4px;
  border-radius: 4px;
  cursor: pointer;
}
.mention-tag:hover {
  background: rgba(75,53,194,0.15);
}

/* ── Mention hover card ── */
.mention-hover-card {
  position: fixed;
  z-index: var(--z-dropdown, 100);
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.08);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  min-width: 180px;
}
.mention-hover-card.visible {
  opacity: 1;
  transform: translateY(0);
}
.mention-card-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.mention-card-avatar-pine {
  background: #144629;
  padding: 6px;
  border-radius: 50%;
}
.mention-card-avatar-fallback {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-room, #4B35C2);
  color: white;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mention-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.mention-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary, #1c1917);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mention-card-role {
  font-size: 12px;
  color: var(--color-text-secondary, #78716c);
}

/* ── Mentioned message highlight ── */
.room-message.mentioned {
  background: rgba(75,53,194,0.04);
  border-left: 3px solid var(--color-room, #4B35C2);
  margin-left: -3px;
}

/* ── Mentioned comment highlight (attention-grabbing) ── */
.room-comment.mention-highlight {
  background: rgba(75,53,194,0.08);
  border-left: 3px solid var(--color-room, #4B35C2);
  border-radius: 0 6px 6px 0;
  padding-left: 10px;
  margin: 2px 0;
  animation: mentionPulse 2s ease-in-out 1;
}
@keyframes mentionPulse {
  0% { background: rgba(75,53,194,0.2); }
  50% { background: rgba(75,53,194,0.1); }
  100% { background: rgba(75,53,194,0.08); }
}

/* ── Sidebar mention dot ── */
.room-mention-dot {
  flex-shrink: 0;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background: var(--color-room, #4B35C2);
  color: white;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  margin-left: auto;
  line-height: 1;
}
.room-mention-dot.bump {
  animation: mentionBump 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes mentionBump {
  0% { transform: scale(1); }
  40% { transform: scale(1.3); }
  100% { transform: scale(1); }
}
.room-item.has-mentions .conv-title {
  font-weight: 600;
  color: var(--color-text-primary, #1c1917);
}
.room-item.has-mentions .room-item-hash {
  opacity: 0.9;
}

/* ── Input container: relative for popover positioning ── */
.chat-wrapper[data-controller="room"] #input-container {
  position: relative;
  overflow: visible;
}

/* ── Mention highlight mirror (sits behind textarea) ── */
.mention-input-wrap {
  flex: 1;
  position: relative;
  min-width: 0;
}
.mention-input-wrap textarea {
  position: relative;
  width: 100%;
  box-sizing: border-box;
}
.mention-mirror {
  position: absolute;
  inset: 0;
  padding: 6px 8px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow: hidden;
  pointer-events: none;
  color: transparent;
  margin-bottom: 2px;
}
.mention-mirror .mention-hl {
  background: rgba(75,53,194,0.15);
  border-radius: 3px;
  color: transparent;
}

/* ── Waiting for response indicator ── */
.room-waiting-indicator {
  animation: roomFadeSlideIn 0.25s ease-out;
}
.room-waiting-indicator .room-msg-body {
  padding: 4px 0;
}
.room-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 0;
}
.room-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-brand);
  animation: typingBounce 1.4s ease-in-out infinite;
}
.room-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.room-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
.room-waiting-slow {
  color: var(--color-text-muted, #79716b);
  font-size: 13px;
  font-style: italic;
}
@keyframes roomFadeSlideIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Dark theme overrides ── */
[data-theme="wistful_juniper"],
[data-theme="deep_current"] {
  /* Message body text */
  .room-msg-body .content { color: var(--color-text-primary); }
  .room-msg-time { color: var(--color-text-muted); }
  .room-msg-name:hover { background: var(--color-hover); }

  /* Comments and reactions */
  .room-comment-toggle { color: var(--color-text-muted); }
  .room-comment-toggle:hover { background: var(--color-hover); color: var(--color-text-secondary); }
  .room-comment-text { color: var(--color-text-secondary); }
  .room-comment-time { color: var(--color-text-muted); }

  /* Borders — stone palette → theme border */
  .room-comment-input-wrap,
  .room-invite-input,
  .room-search-input { border-color: var(--color-border); }

  /* Room intro banner — legible on dark backgrounds */
  .room-intro-banner {
    background: color-mix(in srgb, var(--color-room) 8%, transparent);
    border-color: color-mix(in srgb, var(--color-room) 18%, transparent);
  }
  .room-intro-title { color: var(--color-room); }
  .room-intro-label { color: color-mix(in srgb, var(--color-room) 70%, var(--color-text-muted)); }
  .room-intro-value { color: color-mix(in srgb, var(--color-room) 20%, var(--color-text-secondary)); }
  .room-intro-dismiss { color: var(--color-text-muted); }
  .room-intro-dismiss:hover { color: var(--color-text-secondary); }
  .room-welcome-text { color: color-mix(in srgb, var(--color-room) 50%, var(--color-text-muted)); }
  .room-invite-item-email { color: var(--color-text-muted); }

  /* Avatar overflow badges */
  .room-msg-avatar-overflow,
  .room-item-av-overflow { background: var(--color-hover); color: var(--color-text-muted); }

  /* Neutral backgrounds */
  .room-title-avatars .room-avatar { border-color: var(--color-surface); }

  /* Mention hover card */
  .mention-hover-card { background: var(--color-card); }
  .mention-card-name { color: var(--color-text-primary); }
  .mention-card-role { color: var(--color-text-muted); }

  /* Mention popover */
  .mention-popover { background: var(--color-card); }
  .mention-popover-item:hover,
  .mention-popover-item.active { background: var(--color-hover); }
  .mention-popover-name { color: var(--color-text-primary); }

  /* Room header */
  .room-header { border-color: var(--color-border); }

  /* Room title menu (3-column flyover) */
  .room-title-menu {
    background: var(--color-card);
    box-shadow: 0 0 0 1px var(--color-border), 0 8px 24px rgba(0,0,0,0.3);
  }
  .rm-col + .rm-col { border-color: var(--color-border); }
  .rm-col-label { color: var(--color-text-muted); }
  .rm-col-count { color: var(--color-text-muted); background: var(--color-hover); }
  .rm-rename-input input {
    background: transparent;
    border-color: var(--color-border);
    color: var(--color-text-primary);
  }

  /* Context column text */
  .rm-purpose-empty { color: var(--color-text-muted); }
  .rm-stat-label { color: var(--color-text-muted); }
  .rm-stat-value { color: var(--color-text-primary); }

  /* Members column */
  .rm-member-name { color: var(--color-text-primary); }
  .rm-member-role { color: var(--color-text-muted); }
  .rm-invite-btn { color: var(--color-text-secondary); }
  .rm-invite-btn:hover { background: var(--color-hover); }

  /* Integrations column */
  .rm-integration-btn {
    background: transparent;
    border-color: var(--color-border);
    color: var(--color-text-primary);
  }
  .rm-integration-btn:hover { background: var(--color-hover); }

  /* Integration empty state + chips */
  .rm-int-empty svg { color: var(--color-text-muted); }
  .rm-int-empty > span:first-of-type { color: var(--color-text-secondary); }
  .rm-int-hint { color: var(--color-text-muted); }
  .rm-integrations-loading { color: var(--color-text-muted); }
  .rm-int-chip {
    background: var(--color-card);
    border-color: var(--color-border);
    color: var(--color-text-secondary);
  }
  .rm-int-chip:hover {
    background: var(--color-hover);
    border-color: var(--color-room);
    color: var(--color-text-primary);
  }
  .rm-int-chip-other { color: var(--color-text-muted); }
  .rm-int-item:hover { background: var(--color-hover); }
  .rm-int-icon { background: var(--color-hover); }
  .rm-int-name { color: var(--color-text-primary); }
  .rm-int-email { color: var(--color-text-muted); }
  .rm-int-meta { color: var(--color-text-muted); }

  /* Context column sub-text */
  .rm-purpose-text { color: var(--color-text-secondary); }
  .rm-purpose-editable:hover { background: var(--color-hover); }
  .rm-meta-label { color: var(--color-text-muted); }
  .rm-meta-value { color: var(--color-text-secondary); }
  .rm-usage-toggle { color: var(--color-text-secondary); }
  .rm-usage-toggle:hover { background: var(--color-hover); color: var(--color-text-primary); }
  .rm-usage-loading { color: var(--color-text-muted); }
  .rm-usage-row { color: var(--color-text-secondary); }
  .rm-usage-value { color: var(--color-text-primary); }
  .rm-usage-total { color: var(--color-text-primary); border-top-color: var(--color-border); }
  .rm-usage-empty { color: var(--color-text-muted); }

  /* Room flyover/panel (fallback) */
  .room-flyover { background: var(--color-card); border-color: var(--color-border); }
  .room-flyover-section-title { color: var(--color-text-muted); }

  /* Room sidebar — brighter text and hashes in dark mode */
  .room-item { color: var(--color-text-primary); }
  .room-item-hash { opacity: 0.8; }
  .room-title-hash { opacity: 0.8; }
  .room-item-av-overflow { background: var(--color-hover); color: var(--color-text-muted); }

  /* Translation in dark mode */
  .room-translate-btn { color: var(--color-text-muted); }
  .room-translate-btn:hover { color: var(--color-text-primary); background: var(--color-hover); }
  .room-translated-label { color: var(--color-text-muted); }

  /* ── Suggestion chips — room-tinted for dark backgrounds ── */
  .room-chip {
    background: color-mix(in srgb, var(--color-room) 12%, transparent);
    color: var(--color-room);
  }
  .room-chip:hover {
    background: color-mix(in srgb, var(--color-room) 20%, transparent);
    box-shadow: 0 1px 4px color-mix(in srgb, var(--color-room) 15%, transparent);
  }
  .room-chip.skeleton {
    background: linear-gradient(90deg, color-mix(in srgb, var(--color-room) 8%, transparent) 25%, color-mix(in srgb, var(--color-room) 15%, transparent) 50%, color-mix(in srgb, var(--color-room) 8%, transparent) 75%);
    background-size: 200% 100%;
  }

  /* ── Invite modal ── */
  .room-invite-modal {
    background: var(--color-card);
    color: var(--color-text-primary);
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  }
  .room-invite-search {
    background: var(--color-input-bg);
    border-color: var(--color-border);
    color: var(--color-text-primary);
  }
  .room-invite-item:hover { background: var(--color-hover); }
  .room-invite-item-name { color: var(--color-text-primary); }
  .room-invite-item-email { color: var(--color-text-muted); }
  .room-invite-item-action.invited {
    background: var(--color-hover);
    color: var(--color-text-muted);
  }
  .room-invite-close {
    background: var(--color-hover);
    color: var(--color-text-secondary);
  }
  .room-invite-close:hover { background: var(--color-active); }

  /* ── Create room modal ── */
  .room-create-modal {
    background: var(--color-card);
    color: var(--color-text-primary);
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  }
  .room-modal-tabs { border-color: var(--color-border); }
  .room-modal-tab { color: var(--color-text-muted); }
  .room-modal-tab:hover { color: var(--color-text-primary); }
  .room-create-purpose,
  .room-create-slug-row,
  .room-create-members,
  .room-create-member-results.open { border-color: var(--color-border); }
  .room-create-purpose,
  .room-create-input,
  .room-create-member-search {
    color: var(--color-text-primary);
  }
  .room-create-purpose { background: var(--color-input-bg); }
  .room-create-purpose::placeholder,
  .room-create-input::placeholder,
  .room-create-member-search::placeholder { color: var(--color-text-muted); }
  .room-create-hint,
  .room-create-visibility-hint { color: var(--color-text-muted); }
  .room-create-visibility { color: var(--color-text-secondary); }
  .room-lock-icon { color: var(--color-text-muted); }
  .room-create-divider { background: var(--color-border); }
  .room-create-cancel {
    background: var(--color-hover);
    color: var(--color-text-secondary);
  }
  .room-create-cancel:hover { background: var(--color-active); }
  .room-create-suggestion { background: rgba(255,255,255,0.05); }
  .room-create-suggestion:hover,
  .room-create-suggestion.active { background: rgba(255,255,255,0.08); }
  .room-create-member-item:hover { background: var(--color-hover); }
  .room-create-member-item-name { color: var(--color-text-primary); }
  .room-create-member-results.open { background: var(--color-card); }

  /* Browse rooms (inside create modal) */
  .browse-rooms-loading,
  .browse-rooms-empty { color: var(--color-text-muted); }
  .browse-room-item { border-color: var(--color-border); }
  .browse-room-name { color: var(--color-text-primary); }
  .browse-room-meta { color: var(--color-text-muted); }

  /* ── Tooltip ── */
  .nav-room-tooltip {
    background: var(--color-card);
    border-color: var(--color-border);
    color: var(--color-text-secondary);
    box-shadow: 0 8px 30px rgba(0,0,0,0.3), 0 2px 8px rgba(0,0,0,0.15);
  }

  /* ── Sidebar browse rooms button ── */
  .sidebar-browse-rooms {
    border-color: var(--color-border);
    color: var(--color-text-muted);
  }
  .sidebar-browse-rooms:hover {
    border-color: var(--color-room);
    color: var(--color-room);
  }

  /* ── Pinned messages — dark mode ── */
  .room-pins-bar {
    background: var(--color-surface);
    border-color: var(--color-border);
  }
  .room-pins-header {
    color: var(--color-text-muted);
  }
  .room-pin-card {
    background: var(--color-card);
    border-color: var(--color-border);
  }
  .room-pin-card:hover {
    background: var(--color-hover);
  }
  .room-pin-name {
    color: var(--color-text-primary);
  }
  .room-pin-time {
    color: var(--color-text-muted);
  }
  .room-pin-content {
    color: var(--color-text-secondary);
  }
  .room-pin-unpin {
    color: var(--color-text-muted);
  }
  .room-pin-unpin:hover {
    color: #ef4444;
  }
  .room-pin-btn {
    color: var(--color-text-muted);
  }
  .room-pin-btn:hover {
    color: var(--color-room);
  }
  .room-pin-btn.pinned {
    color: var(--color-room);
  }
  .pin-dot {
    background: var(--color-room);
  }

  /* ── File upload — dark mode ── */
  .room-file-upload-btn {
    color: var(--color-text-muted);
  }
  .room-file-upload-btn:hover {
    background: var(--color-hover);
    color: var(--color-text-primary);
  }
  .room-file-badges {
    background: transparent;
  }
  .room-file-badge {
    background: var(--color-card);
    border-color: var(--color-border);
    color: var(--color-text-primary);
  }
  .room-file-badge.error {
    border-color: rgba(239,68,68,0.3);
    color: #ef4444;
  }
  .room-file-badge-status {
    color: var(--color-text-muted);
  }
  .room-file-badge.ready .room-file-badge-status {
    color: #4ade80;
  }
  .room-file-badge-remove {
    color: var(--color-text-muted);
  }
  .room-file-badge-remove:hover {
    color: #ef4444;
  }
  .room-file-badge .status-typing span {
    background: var(--color-text-muted);
  }
}

/* ── Message translation ── */
.room-translate-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding-left: 44px;
}
.room-message.consecutive .room-translate-bar {
  padding-left: 44px;
}
.room-translate-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border: none;
  border-radius: 4px;
  background: none;
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-muted, #999);
  cursor: pointer;
  transition: color 0.1s, background 0.1s;
}
.room-translate-btn:hover {
  color: var(--color-text-secondary, #666);
  background: var(--color-hover, rgba(0,0,0,0.04));
}
.room-translate-btn svg { flex-shrink: 0; }

.room-translated-label {
  font-size: 11px;
  color: var(--color-text-muted, #999);
  font-style: italic;
}

/* Shimmer animation on message content during translation */
@keyframes room-translate-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.room-msg-body .content.translating {
  position: relative;
}
.room-msg-body .content.translating::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(75,53,194,0.06) 40%,
    rgba(75,53,194,0.12) 50%,
    rgba(75,53,194,0.06) 60%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: room-translate-shimmer 1.2s ease-in-out infinite;
  pointer-events: none;
}

/* ── Mobile: room flyover stacks vertically ── */
@media (max-width: 768px) {
  .room-title-menu {
    left: 8px;
    right: 8px;
    transform: translateY(-8px) scale(0.97);
    max-height: 70vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .room-title-menu.open {
    transform: translateY(0) scale(1);
  }
  .rm-columns {
    flex-direction: column;
    min-width: 0;
  }
  .rm-col + .rm-col {
    border-left: none;
    border-top: 1px solid rgba(0,0,0,0.06);
  }
}

/* ── Pinned messages bar ── */
.room-pins-bar {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  background: var(--color-surface, #fff);
  padding: 0 16px;
}
.room-pins-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  color: var(--color-text-muted, #79716b);
  font-size: 12px;
  font-weight: 500;
  cursor: default;
}
.room-pins-header svg { opacity: 0.6; }
.room-pins-count { flex: 1; }
.room-pins-toggle {
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: inherit;
  display: flex;
  align-items: center;
}
.room-pins-chevron {
  transition: transform 0.2s;
}
.room-pins-chevron.expanded {
  transform: rotate(180deg);
}
.room-pins-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 10px;
}
.room-pin-card {
  background: var(--color-surface-raised, #fafaf9);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 8px;
  padding: 8px 12px;
  position: relative;
  cursor: pointer;
  transition: opacity 0.2s, background 0.12s;
}
.room-pin-card:hover {
  background: var(--color-hover, rgba(0,0,0,0.02));
}
.room-pin-card.refreshing {
  opacity: 0.7;
}

/* Pin card header — matches message header style */
.room-pin-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.room-pin-avatar,
.room-pin-avatar-fallback {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
}
.room-pin-avatar { object-fit: cover; }
.room-pin-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-room, #4B35C2);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
}
.room-pin-avatar-pine {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.room-pin-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-primary, #1c1917);
}
.room-pin-time {
  font-size: 11px;
  color: var(--color-text-muted, #79716b);
}
.room-pin-updated {
  font-size: 11px;
  color: var(--color-text-muted, #79716b);
  opacity: 0.7;
}
.room-pin-unpin {
  margin-left: auto;
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: var(--color-text-muted, #79716b);
  opacity: 0;
  transition: opacity 0.15s;
  display: flex;
  align-items: center;
}
.room-pin-card:hover .room-pin-unpin { opacity: 0.6; }
.room-pin-unpin:hover { opacity: 1 !important; color: var(--color-danger, #dc2626); }

/* Pin content — truncated to 2 lines */
.room-pin-content {
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-text-secondary, #44403c);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
.room-pin-content p { margin: 0; display: inline; }
.room-pin-content p + p::before { content: " "; }
.room-pin-content pre,
.room-pin-content ul,
.room-pin-content ol,
.room-pin-content h1,
.room-pin-content h2,
.room-pin-content h3 { display: inline; font-size: inherit; font-weight: inherit; margin: 0; padding: 0; }
.room-pin-content li { display: inline; }
.room-pin-content li::before { content: " · "; }
.room-pin-content code { font-size: 12px; }

/* Scroll-to highlight animation */
@keyframes pin-highlight-flash {
  0% { background: var(--color-room, #4B35C2); box-shadow: 0 0 0 4px rgba(75,53,194,0.15); }
  100% { background: transparent; box-shadow: none; }
}
.room-message.pin-highlight {
  animation: pin-highlight-flash 1.5s ease-out;
  border-radius: 8px;
}

/* Pin refreshing dots animation */
.room-pin-refreshing {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.pin-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--color-room, #4B35C2);
  opacity: 0.4;
  animation: pin-dot-pulse 1.4s infinite ease-in-out;
}
.pin-dot:nth-child(2) { animation-delay: 0.2s; }
.pin-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes pin-dot-pulse {
  0%, 80%, 100% { opacity: 0.4; transform: scale(1); }
  40% { opacity: 1; transform: scale(1.2); }
}

/* ── Pin button on messages ── */
.room-pin-btn {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--color-text-muted, #79716b);
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  display: flex;
  align-items: center;
}
.room-message:hover .room-pin-btn { opacity: 0.5; }
.room-pin-btn:hover { opacity: 1 !important; color: var(--color-room, #4B35C2); }
.room-pin-btn.pinned {
  opacity: 0.8;
  color: var(--color-room, #4B35C2);
}
.room-message:hover .room-pin-btn.pinned { opacity: 1; }

.room-msg-actions-user {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

/* ── File upload ── */
.room-file-upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  cursor: pointer;
  border-radius: 6px;
  color: var(--color-text-muted, #79716b);
  transition: background 0.12s, color 0.12s;
  flex-shrink: 0;
}
.room-file-upload-btn:hover {
  background: rgba(0,0,0,0.04);
  color: var(--color-text-primary, #1c1917);
}

.room-file-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px 0;
}
.room-file-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-surface-raised, #fafaf9);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  color: var(--color-text-primary, #1c1917);
}
.room-file-badge.error {
  border-color: rgba(220,38,38,0.2);
  color: var(--color-danger, #dc2626);
}
.room-file-badge-name {
  font-weight: 500;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.room-file-badge-status {
  color: var(--color-text-muted, #79716b);
  font-size: 11px;
}
.room-file-badge.ready .room-file-badge-status {
  color: var(--color-success, #16a34a);
}
.room-file-badge-remove {
  background: none;
  border: none;
  padding: 0 2px;
  cursor: pointer;
  font-size: 14px;
  color: var(--color-text-muted, #79716b);
  line-height: 1;
}
.room-file-badge-remove:hover { color: var(--color-danger, #dc2626); }

/* Typing dots inside badge */
.room-file-badge .status-typing {
  display: inline-flex;
  gap: 2px;
}
.room-file-badge .status-typing span {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--color-text-muted, #79716b);
  animation: typing-dots 1.4s infinite ease-in-out;
}
.room-file-badge .status-typing span:nth-child(2) { animation-delay: 0.2s; }
.room-file-badge .status-typing span:nth-child(3) { animation-delay: 0.4s; }

/* Attachment download badges on messages */
.room-msg-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.room-msg-attachment {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  color: var(--color-text-secondary, #94a3b8);
  text-decoration: none;
  font-size: 13px;
  transition: background 0.15s;
  cursor: pointer;
}

.room-msg-attachment:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text, #e2e8f0);
}

.room-msg-attachment svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.room-msg-attachment:hover svg {
  opacity: 1;
}

.room-msg-attachment-name {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.room-msg-attachment-size {
  opacity: 0.5;
  font-size: 11px;
  white-space: nowrap;
}
