/* Component layout for the Enclave PWA. Loaded after theme.css.
   Telegram-shaped: two-pane on desktop (≥768px), single-pane on
   mobile with the conversation list as the home view and the
   thread sliding in on tap. */

/* -- splash + sign-in --------------------------------------------- */

.splash, .signin-screen {
  display: grid;
  place-items: center;
  height: 100%;
  padding: 1.5rem;
}
.splash-title, .signin-title {
  font-size: 2rem;
  margin: 0 0 0.25rem;
  letter-spacing: -0.02em;
}
.splash-subtitle, .signin-subtitle {
  color: var(--fg-muted);
  margin: 0 0 1.5rem;
}

.signin-card {
  width: 100%;
  max-width: 22rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem 1.5rem;
  display: grid;
  gap: 0.9rem;
  text-align: center;
}
.signin-label {
  display: grid;
  gap: 0.3rem;
  text-align: left;
  font-size: 13px;
  color: var(--fg-muted);
}
.signin-label input {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  font-size: 15px;
  background: var(--bg-input);
}
.signin-label input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.signin-error {
  background: #4a2020;
  color: #ffd9d9;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 13px;
}
.signin-submit {
  background: var(--accent);
  color: #fff;
  padding: 0.75rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 15px;
  margin-top: 0.5rem;
  transition: background 0.15s;
}
.signin-submit:hover { background: var(--accent-hover); }
.signin-hint { font-size: 12px; color: var(--fg-dim); margin-top: 0.25rem; }
.signin-hint code { background: rgba(255,255,255,0.06); padding: 0.1em 0.4em; border-radius: 4px; }

/* -- app shell (two-pane / one-pane) ------------------------------ */

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  flex: 1;
  min-height: 0;
  width: 100%;
  background: var(--bg);
  /* `clip` is stronger than `hidden`: it disables ALL scrolling on
     this container, including the focus-driven auto-scroll Chrome
     does when a child element receives focus. With `hidden`, focusing
     a textarea inside the offscreen pane caused Chrome to set
     scrollLeft to bring it into view, breaking the slide layout.
     `clip` removes the scroll container entirely. */
  overflow: clip;
}

/* Right-pane column: thread on top, input row docked at bottom. */
.thread-column {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.thread-column > .thread { flex: 1; min-height: 0; }
.thread-column > .input-mount { flex-shrink: 0; }

@media (max-width: 899px) {
  /* Mobile single-pane: panes are absolutely positioned at the same
     coordinate (top:0, left:0, full viewport). The active pane is
     transform: translateX(0); the inactive pane is parked at
     translateX(100%) (offscreen right) or -100%. No flex / grid
     overflow involved — there's no horizontal content to overflow,
     so Chrome can't auto-scroll the container into a broken state.
     This is the same pattern Telegram Web uses on mobile. */
  .app-shell {
    display: block;
    grid-template-columns: unset;
    width: 100vw;
    max-width: 100vw;
    position: relative;
    overflow: clip;
  }
  .app-shell > * {
    position: absolute;
    inset: 0;
    width: 100vw;
    max-width: 100vw;
    min-width: 0;
    transition: transform 0.2s ease-out;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  /* Default (data-pane="list"): sidebar at 0, thread parked right. */
  .app-shell > *:nth-child(1) { transform: translateX(0); }
  .app-shell > *:nth-child(2) { transform: translateX(100%); }
  /* Thread view: sidebar slides off left, thread slides into 0. */
  body[data-pane="thread"] .app-shell > *:nth-child(1) { transform: translateX(-100%); }
  body[data-pane="thread"] .app-shell > *:nth-child(2) { transform: translateX(0); }
}

/* -- avatar ------------------------------------------------------- */

.avatar {
  width: var(--avatar-size);
  height: var(--avatar-size);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  color: rgba(0, 0, 0, 0.85);
  flex-shrink: 0;
  user-select: none;
}

/* -- sidebar ------------------------------------------------------ */

.sidebar {
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-header {
  height: var(--header-height);
  padding: 0 1rem;
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  /* Subtle top-down gradient — gives the header a small lift over
     the conversation list below, like Telegram. Bottom edge sits
     just above the elevated bg so the border still reads. */
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-elevated) 88%, white 12%) 0%, var(--bg-elevated) 100%);
}
.sidebar-title {
  font-weight: 700; font-size: 17px; letter-spacing: -0.01em;
  flex: 1; /* push the icon buttons to the right */
}
.sidebar-add, .sidebar-menu-btn {
  width: 36px; height: 36px; border-radius: 50%;
  color: var(--fg-muted);
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.sidebar-add svg, .sidebar-menu-btn svg {
  width: 20px; height: 20px;
}
.sidebar-add:hover, .sidebar-menu-btn:hover {
  color: var(--fg); background: var(--bg-input);
}

/* More-menu popup — anchored to the menu button, fades in on open. */
.sidebar-menu-wrap { position: relative; flex: 0 0 auto; }
.sidebar-menu-popup {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  padding: 4px;
  display: none;
  z-index: 50;
}
.sidebar-menu-wrap.is-open .sidebar-menu-popup { display: block; }
.sidebar-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--fg);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.sidebar-menu-item:hover { background: var(--bg-input); }
.sidebar-menu-item.is-danger { color: #f47b7b; }
.sidebar-menu-item.is-danger:hover { background: rgba(244, 123, 123, 0.1); }
.sidebar-menu-item-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  flex: 0 0 18px;
}
.sidebar-menu-item-icon svg { width: 18px; height: 18px; }
.sidebar-menu-version {
  padding: 6px 12px 4px;
  font-size: 11px;
  color: var(--fg-dim);
  font-family: ui-monospace, SF Mono, Menlo, Consolas, monospace;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.sidebar-self {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
}
.sidebar-self-meta { display: grid; gap: 0; }
.sidebar-self-name { font-weight: 600; font-size: 14px; }
.sidebar-self-status { font-size: 12px; color: var(--fg-muted); }

.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
}
.sidebar-empty { padding: 1.5rem 1rem; color: var(--fg-muted); font-size: 14px; }

.sidebar-row {
  display: grid;
  grid-template-columns: var(--avatar-size) 1fr auto;
  gap: 0.75rem;
  align-items: center;
  width: 100%;
  padding: 0.6rem 1rem;
  text-align: left;
  border-radius: 0;
  transition: background 0.1s;
}
.sidebar-row:hover { background: var(--bg-input); }
.sidebar-row.is-active { background: rgba(79, 140, 255, 0.15); }
.sidebar-row-body { min-width: 0; display: grid; gap: 2px; }
.sidebar-row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.sidebar-row-name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-row-time { font-size: 12px; color: var(--fg-muted); flex-shrink: 0; }
.sidebar-row-snippet {
  font-size: 13px;
  color: var(--fg-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}
.sidebar-row-unread {
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 0 7px;
  height: 18px;
  line-height: 18px;
  border-radius: 9px;
  min-width: 18px;
  text-align: center;
}

/* -- thread ------------------------------------------------------- */

.thread {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
.thread-empty {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--fg-muted);
  font-size: 14px;
}
.thread-header {
  height: var(--header-height);
  padding: 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  border-bottom: 1px solid var(--border);
  /* Match sidebar-header gradient. Top has a slight lift; bottom
     fades to the elevated bg so messages tuck under it cleanly. */
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-elevated) 88%, white 12%) 0%, var(--bg-elevated) 100%);
  flex-shrink: 0;
}
.thread-back {
  width: 32px; height: 32px;
  font-size: 24px;
  color: var(--accent);
  display: none;
  line-height: 1;
}
@media (max-width: 899px) { .thread-back { display: block; } }
.thread-header-meta { display: grid; gap: 0; min-width: 0; flex: 1; }
.thread-header-title { font-weight: 600; font-size: 15px; }
.thread-header-subtitle { font-size: 12px; color: var(--fg-muted); }

.thread-leave {
  background: none;
  border: none;
  color: var(--fg-muted);
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  flex: 0 0 auto;
}
.thread-leave svg { width: 20px; height: 20px; }
.thread-leave:hover {
  color: #f47b7b;
  background: rgba(244, 123, 123, 0.12);
}

.thread-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.thread-day { display: grid; place-items: center; margin: 0.6rem 0 0.4rem; }
.thread-day-pill {
  background: var(--bg-input);
  color: var(--fg-muted);
  font-size: 12px;
  padding: 3px 12px;
  border-radius: 12px;
}

/* -- bubble ------------------------------------------------------- */

.bubble-wrap {
  display: grid;
  grid-template-columns: var(--avatar-size) 1fr;
  gap: 0.5rem;
  align-items: end;
  margin-top: 0.5rem;
}
.bubble-wrap.is-continued { margin-top: 1px; }
.bubble-wrap.is-self {
  grid-template-columns: 1fr;
  justify-items: end;
}
.bubble-avatar { align-self: end; }
.bubble {
  max-width: min(70%, 540px);
  padding: 0.5rem 0.75rem 0.4rem;
  border-radius: var(--bubble-radius);
  background: var(--bubble-other);
  color: var(--bubble-other-text);
  box-shadow: var(--shadow-bubble);
  position: relative;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.is-self .bubble {
  background: var(--bubble-self);
  color: var(--bubble-self-text);
  border-bottom-right-radius: 4px;
}
.is-other .bubble {
  border-bottom-left-radius: 4px;
}
.is-continued.is-self .bubble {
  border-top-right-radius: 4px;
}
.is-continued.is-other .bubble {
  border-top-left-radius: 4px;
  /*
   * Streak-continued bubbles (same sender, <60 s gap) skip the
   * avatar element. Without this, the bubble auto-flows into the
   * empty first grid track (width = var(--avatar-size) ≈ 32 px) and
   * gets squished to ~30 px wide. Pin it to track 2 so it gets the
   * full 1fr column the leader bubble had.
   */
  grid-column: 2;
}
.bubble-sender {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}
.bubble-text { font-size: 15px; line-height: 1.35; white-space: pre-wrap; }
.bubble-multi .bubble-line { padding: 0; min-height: 1.35em; }
/* Empty lines render as visible blank rows — preserve the
   sender's intended spacing in multi-line BATCHes. */
.bubble-multi .bubble-line:empty::before { content: '\00a0'; }
.bubble-multi .bubble-line + .bubble-line { margin-top: 1px; }

/* Jumbo single-emoji rendering — a bare 🎉 or two should render
   without the bubble chrome and at ~3x size, the Telegram/iMessage
   convention. */
.bubble-jumbo {
  font-size: 48px;
  line-height: 1.1;
  letter-spacing: 0.05em;
}
.bubble-emoji-only {
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
}
.is-self .bubble-emoji-only { padding-right: 4px !important; }
.bubble-emoji-only .bubble-time { color: var(--fg-muted); margin-top: 4px; }
.bubble-emoji-only .bubble-sender { font-size: 13px; }

/* Always-visible action affordance on each bubble (desktop).
   Sits at the bubble's top corner INSIDE the bubble's hit area —
   no hover-to-show, no vanish-on-leave dance, the button is just
   always reachable. Low-opacity at rest, full-opacity on hover. */
.bubble { position: relative; }
.bubble-action-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.25);
  color: var(--fg);
  font-size: 13px;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.12s, background 0.12s;
}
.is-self .bubble-action-btn { right: auto; left: 4px; }
.bubble:hover .bubble-action-btn { opacity: 0.7; }
.bubble-action-btn:hover { opacity: 1 !important; background: rgba(0, 0, 0, 0.5); }
/* Hide the action affordance on jumbo-emoji-only bubbles —
   they have no chrome to anchor it against. The action menu is
   still reachable via long-press / right-click. */
.bubble-emoji-only .bubble-action-btn { display: none; }
/* Touch devices have no hover; rely on long-press instead. */
@media (hover: none) {
  .bubble-action-btn { display: none; }
}

.bubble-time {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
  text-align: right;
  margin-top: 2px;
}
.is-other .bubble-time { color: var(--fg-muted); }

.bubble-quote {
  border-left: 3px solid var(--accent);
  background: rgba(79, 140, 255, 0.08);
  padding: 4px 8px;
  border-radius: 4px;
  margin-bottom: 4px;
  font-size: 13px;
}
.bubble-quote-author { font-weight: 600; }
.bubble-quote-text { color: var(--fg-muted); }

.bubble-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.react-chip {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 12px;
  display: inline-flex;
  gap: 3px;
  cursor: pointer;
  transition: background 0.1s;
}
.react-chip:hover { background: rgba(255, 255, 255, 0.14); }
.react-chip.is-you {
  background: rgba(79, 140, 255, 0.2);
  border-color: var(--accent);
}

/* -- action tray (click-to-open, Telegram-shape) ----------------- */

.action-menu {
  position: fixed;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 6px;
  display: grid;
  gap: 0;
  width: 280px;
  box-shadow: var(--shadow-pop);
  z-index: 1000;
}
.action-menu-emojis {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
}
.action-menu-emoji {
  width: 100%;
  height: 36px;
  background: transparent;
  border-radius: 8px;
  font-size: 22px;
  display: grid;
  place-items: center;
  transition: transform 0.08s, background 0.08s;
}
.action-menu-emoji:hover {
  background: var(--bg-input);
  transform: scale(1.15);
}
.action-menu-emoji-more {
  font-size: 16px;
  color: var(--fg-muted);
}
.action-menu-action {
  background: transparent;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  text-align: left;
  margin-top: 2px;
}
.action-menu-action:hover { background: var(--bg-input); }

/* -- input row ---------------------------------------------------- */

.input-row {
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  padding: 8px 8px 8px;
  flex-shrink: 0;
}
.input-row-inner {
  display: grid;
  grid-template-columns: 36px 36px 1fr 36px;
  gap: 6px;
  align-items: end;
}
.input-textarea {
  resize: none;
  min-height: 40px;
  max-height: 120px;
  padding: 9px 12px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.3;
  background: var(--bg-input);
}
.input-textarea:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.input-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 18px;
  color: var(--fg-muted);
  transition: background 0.1s, color 0.1s;
}
.input-btn:hover:not(:disabled) { background: var(--bg-input); color: var(--fg); }
.input-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.input-btn-send {
  background: var(--accent);
  color: #fff;
}
.input-btn-send:hover:not(:disabled) { background: var(--accent-hover); color: #fff; }

.reply-banner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: var(--bg-input);
  border-left: 3px solid var(--accent);
  padding: 6px 10px;
  margin: 0 4px 8px;
  border-radius: 4px;
  font-size: 13px;
}
.reply-banner-author { font-weight: 600; font-size: 12px; }
.reply-banner-text { color: var(--fg-muted); margin-top: 2px; }
.reply-banner-close {
  font-size: 18px;
  color: var(--fg-muted);
  margin-left: 8px;
  line-height: 1;
}
.reply-banner-close:hover { color: var(--fg); }

/* -- emoji picker (vendored emoji-picker-element) --------------- */

.emoji-picker-popover {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 0;
  z-index: 1000;
  box-shadow: var(--shadow-pop);
  overflow: hidden;
}
emoji-picker {
  --background: var(--bg-elevated);
  --border-color: var(--border-strong);
  --button-active-background: var(--accent);
  --button-hover-background: var(--bg-input);
  --indicator-color: var(--accent);
  --input-border-color: var(--border-strong);
  --input-font-color: var(--fg);
  --input-placeholder-color: var(--fg-muted);
  --outline-color: var(--accent);
  --category-emoji-padding: 0.25rem;
  height: 320px;
  width: 320px;
}

/* -- chat history sentinel + spinner --------------------------- */

.history-sentinel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  font-size: 12px;
  color: var(--fg-muted);
  min-height: 18px;
}
.history-sentinel.is-idle {
  min-height: 4px;
  padding: 0;
}
.history-sentinel.is-end {
  border-bottom: 1px solid var(--border);
  margin: 0 12px 8px;
  padding-bottom: 12px;
}
.history-sentinel-label {
  font-style: italic;
}
.history-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  animation: history-spin 800ms linear infinite;
}
@keyframes history-spin {
  to { transform: rotate(360deg); }
}

/* -- modal (join / create room) -------------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
}
.modal-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  width: min(440px, 92vw);
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-pop);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}
.modal-close {
  background: none;
  border: none;
  color: var(--fg-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.modal-close:hover { color: var(--fg); }
.modal-tabs {
  display: flex;
  gap: 4px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
}
.modal-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 12px 14px;
  color: var(--fg-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.modal-tab.is-active {
  color: var(--fg);
  border-bottom-color: var(--accent);
}
.modal-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}
.modal-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--fg);
  font-size: 14px;
  outline: none;
}
.modal-input:focus { border-color: var(--accent); }
.modal-hint {
  font-size: 12px;
  color: var(--fg-muted);
}
.modal-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  max-height: 240px;
  overflow-y: auto;
}
.modal-list-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
  color: var(--fg);
}
.modal-list-row:last-child { border-bottom: none; }
.modal-list-row:hover {
  background: var(--bg-input);
}
.modal-list-name {
  font-weight: 500;
  font-size: 14px;
}
.modal-list-meta {
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 2px;
}
.modal-list-empty {
  padding: 18px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--fg-muted);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}
.modal-btn {
  border: none;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.modal-btn-secondary {
  background: var(--bg-input);
  color: var(--fg);
}
.modal-btn-primary {
  background: var(--accent);
  color: white;
}
.modal-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.modal-error {
  font-size: 12px;
  color: #f47c7c;
}

.sidebar-add {
  background: none;
  border: none;
  color: var(--fg-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  margin-right: 4px;
  padding: 0 4px;
}
.sidebar-add:hover { color: var(--fg); }

.thread-header-error {
  font-size: 12px;
  color: #f47c7c;
  margin-top: 2px;
}

/* -- inline image preview --------------------------------------- */

.bubble-image {
  display: block;
  max-width: 320px;
  max-height: 240px;
  border-radius: 10px;
  margin-top: 6px;
  cursor: pointer;
  background: var(--bg-input);
  object-fit: contain;
}
.bubble-image[hidden] { display: none; }

.bubble-link {
  color: var(--accent);
  /*
   * `word-break: break-all` on a child collapses the parent grid
   * track's min-content to 1 char, which makes the WHOLE bubble
   * (including non-link siblings) shrink to one character per line
   * once a long URL appears. `overflow-wrap: anywhere` only breaks
   * to relieve overflow and keeps min-content at the natural word
   * size, so plain text continues to flow normally next to a long
   * URL. The bubble itself already has `overflow-wrap: anywhere`,
   * so this is mostly belt-and-braces for the link element.
   */
  overflow-wrap: anywhere;
}
.bubble-link:hover {
  text-decoration: underline;
}
