/* ==========================================================================
   Muse Talk — Dark Editorial Theme (Phone-First 390px -> Desktop)
   Palette: Obsidian charcoal surfaces + single warm amber accent (#E5A93C)
   ========================================================================== */

:root {
  --bg-canvas: #0e0f12;
  --bg-surface: #14161b;
  --bg-elevated: #1b1e25;
  --bg-input: #101217;
  --bg-hover: #21252e;

  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-medium: rgba(255, 255, 255, 0.12);
  --border-accent: rgba(229, 169, 60, 0.42);

  --text-primary: #f3f2ee;
  --text-secondary: #a1a6b2;
  --text-muted: #6c727f;

  /* Single strong accent: Warm Amber */
  --accent: #e5a93c;
  --accent-hover: #f2bc57;
  --accent-soft: rgba(229, 169, 60, 0.13);
  --accent-glow: rgba(229, 169, 60, 0.24);
  --accent-ink: #12100b;

  /* Semantic status colors */
  --status-ok: #3cc68a;
  --status-ok-soft: rgba(60, 198, 138, 0.14);
  --status-load: #e5a93c;
  --status-load-soft: rgba(229, 169, 60, 0.14);
  --status-err: #e5645c;
  --status-err-soft: rgba(229, 100, 92, 0.14);

  /* Typography */
  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Radii & Shadows */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.34);
  --shadow-float: 0 8px 24px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  background: var(--bg-canvas);
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-primary);
  background:
    radial-gradient(900px 420px at 50% -120px, rgba(229, 169, 60, 0.07), transparent 70%),
    var(--bg-canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

button,
input,
select,
textarea {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

/* ==========================================================================
   App Shell & Sticky Header
   ========================================================================== */

.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(14, 15, 18, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid var(--border-accent);
  color: var(--accent);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.brand-text {
  min-width: 0;
}

.site-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text-primary);
}

.site-subtitle {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Connection Status Indicator */
.header-status-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-pill.status-connected {
  background: var(--status-ok-soft);
  border-color: rgba(60, 198, 138, 0.28);
  color: #6ce0ad;
}

.status-pill.status-connected .status-dot {
  background: var(--status-ok);
  box-shadow: 0 0 8px rgba(60, 198, 138, 0.75);
}

.status-pill.status-loading {
  background: var(--status-load-soft);
  border-color: rgba(229, 169, 60, 0.28);
  color: var(--accent-hover);
}

.status-pill.status-loading .status-dot {
  background: var(--status-load);
  animation: pulseDot 1.1s ease-in-out infinite;
}

.status-pill.status-error {
  background: var(--status-err-soft);
  border-color: rgba(229, 100, 92, 0.34);
  color: #f38c86;
}

.status-pill.status-error .status-dot {
  background: var(--status-err);
}

.last-sync {
  font-family: var(--font-mono);
  font-size: 0.67rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Mobile quick summary bar (hidden on desktop) */
.mobile-summary-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(20, 22, 27, 0.72);
}

.summary-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.78rem;
  padding: 2px 0;
}

.summary-chip-value {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.summary-divider {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-muted);
}

.summary-spacer {
  flex: 1;
}

.summary-link {
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--accent);
}

.summary-link:hover {
  color: var(--accent-hover);
}

/* ==========================================================================
   Error Banner
   ========================================================================== */

.error-banner {
  max-width: 1180px;
  width: 100%;
  margin: 12px auto 0;
  padding: 0 14px;
}

.error-banner-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(229, 100, 92, 0.11);
  border: 1px solid rgba(229, 100, 92, 0.32);
}

.error-icon {
  color: #f38c86;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.error-content {
  flex: 1;
  min-width: 0;
}

.error-title {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  color: #ffd5d2;
}

.error-detail {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: #f0b2ad;
  word-break: break-word;
}

.btn-retry {
  flex-shrink: 0;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(243, 140, 134, 0.42);
  background: rgba(229, 100, 92, 0.2);
  color: #ffe8e6;
  font-size: 0.8rem;
  font-weight: 600;
  transition: background-color 0.16s ease, transform 0.12s ease;
}

.btn-retry:hover {
  background: rgba(229, 100, 92, 0.32);
}

.btn-retry:active {
  transform: scale(0.97);
}

/* ==========================================================================
   Workspace Layout (Phone-first single column -> Desktop 2-column)
   ========================================================================== */

.workspace {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 12px 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

/* ==========================================================================
   Chat Panel (Filter Bar + Live Feed + Composer)
   ========================================================================== */

.chat-panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  min-width: 0;
}

/* Search & Sender Filter */
.filter-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.015);
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 42px;
  padding: 0 34px 0 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 16px; /* Prevents iOS/Android auto-zoom */
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.search-input::placeholder {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.search-input:focus {
  border-color: var(--border-accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Hide browser native search cancel icon so our custom button is clean */
.search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.clear-search-btn {
  position: absolute;
  right: 6px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.clear-search-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sender-filter-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.sender-select {
  appearance: none;
  -webkit-appearance: none;
  height: 42px;
  max-width: 146px;
  padding: 0 30px 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.sender-select:focus {
  border-color: var(--border-accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.select-chevron {
  position: absolute;
  right: 10px;
  color: var(--text-muted);
  pointer-events: none;
}

.filter-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  background: var(--accent-soft);
  border-bottom: 1px solid rgba(229, 169, 60, 0.18);
  font-size: 0.8rem;
  color: #f4d69c;
}

.link-btn {
  border: none;
  background: transparent;
  color: var(--accent-hover);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 2px 4px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-btn:hover {
  color: #fff2d4;
}

/* ==========================================================================
   Message Feed & Bubbles
   ========================================================================== */

.feed-viewport-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.message-feed {
  flex: 1;
  min-height: 360px;
  max-height: 58dvh;
  overflow-y: auto;
  padding: 18px 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

.message-feed::-webkit-scrollbar {
  width: 6px;
}

.message-feed::-webkit-scrollbar-track {
  background: transparent;
}

.message-feed::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}

.message-feed::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.24);
}

/* Date Divider */
.date-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0 2px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.date-divider::before,
.date-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

/* Message Row & Bubble */
.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  max-width: 92%;
  animation: msgIn 0.24s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.msg-row.is-tuan {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-row.is-other {
  align-self: flex-start;
}

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border: 1px solid var(--sender-border, var(--border-medium));
  background: var(--sender-soft, var(--bg-elevated));
  color: var(--sender-color, var(--accent));
}

.msg-bubble {
  min-width: 0;
  padding: 11px 14px 10px;
  border-radius: 16px;
  border: 1px solid var(--sender-bubble-border, var(--border-subtle));
  background: var(--sender-bubble-bg, var(--bg-elevated));
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.msg-row.is-tuan .msg-bubble {
  border-bottom-right-radius: 5px;
}

.msg-row.is-other .msg-bubble {
  border-bottom-left-radius: 5px;
}

.msg-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin-bottom: 5px;
}

.msg-sender {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--sender-color, var(--accent));
  letter-spacing: 0.01em;
}

.msg-recipient-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: var(--text-secondary);
}

.msg-row.is-tuan .msg-recipient-pill {
  background: rgba(229, 169, 60, 0.15);
  border-color: rgba(229, 169, 60, 0.3);
  color: #f5d38f;
}

.msg-body {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.56;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-footer {
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.msg-time {
  font-family: var(--font-mono);
  font-size: 0.69rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Per-sender themes (subtle, tasteful, cohesive with dark obsidian + amber) */
.sender-theme-tuan {
  --sender-color: #f2bc57;
  --sender-soft: rgba(229, 169, 60, 0.16);
  --sender-border: rgba(229, 169, 60, 0.38);
  --sender-bubble-bg: rgba(229, 169, 60, 0.11);
  --sender-bubble-border: rgba(229, 169, 60, 0.28);
}

.sender-theme-simon {
  --sender-color: #63c7b8;
  --sender-soft: rgba(99, 199, 184, 0.13);
  --sender-border: rgba(99, 199, 184, 0.32);
  --sender-bubble-bg: #182124;
  --sender-bubble-border: rgba(99, 199, 184, 0.22);
}

.sender-theme-gun {
  --sender-color: #e48e66;
  --sender-soft: rgba(228, 142, 102, 0.14);
  --sender-border: rgba(228, 142, 102, 0.32);
  --sender-bubble-bg: #221b18;
  --sender-bubble-border: rgba(228, 142, 102, 0.22);
}

.sender-theme-muse-a {
  --sender-color: #8fb88f;
  --sender-soft: rgba(143, 184, 143, 0.14);
  --sender-border: rgba(143, 184, 143, 0.32);
  --sender-bubble-bg: #19201b;
  --sender-bubble-border: rgba(143, 184, 143, 0.22);
}

.sender-theme-muse-b {
  --sender-color: #7ea8d1;
  --sender-soft: rgba(126, 168, 209, 0.14);
  --sender-border: rgba(126, 168, 209, 0.32);
  --sender-bubble-bg: #171e25;
  --sender-bubble-border: rgba(126, 168, 209, 0.22);
}

.sender-theme-muse-c {
  --sender-color: #d69c84;
  --sender-soft: rgba(214, 156, 132, 0.14);
  --sender-border: rgba(214, 156, 132, 0.32);
  --sender-bubble-bg: #221c1a;
  --sender-bubble-border: rgba(214, 156, 132, 0.22);
}

.sender-theme-muse-d {
  --sender-color: #b7be78;
  --sender-soft: rgba(183, 190, 120, 0.14);
  --sender-border: rgba(183, 190, 120, 0.32);
  --sender-bubble-bg: #1e2018;
  --sender-bubble-border: rgba(183, 190, 120, 0.22);
}

/* Empty & Loading States inside Feed */
.feed-state {
  margin: auto;
  max-width: 360px;
  padding: 28px 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.feed-state-icon {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: var(--accent-soft);
  border: 1px solid var(--border-accent);
  color: var(--accent);
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}

.feed-state-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.feed-state-desc {
  margin: 0;
  font-size: 0.87rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.feed-state-cta {
  margin-top: 6px;
  min-height: 40px;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-accent);
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-size: 0.84rem;
  font-weight: 600;
  transition: background-color 0.18s ease, transform 0.12s ease;
}

.feed-state-cta:hover {
  background: rgba(229, 169, 60, 0.22);
}

.feed-state-cta:active {
  transform: scale(0.97);
}

.loading-pulse {
  display: inline-flex;
  gap: 6px;
  margin-bottom: 4px;
}

.loading-pulse span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.35;
  animation: bounceFade 1.2s ease-in-out infinite;
}

.loading-pulse span:nth-child(2) {
  animation-delay: 0.16s;
}

.loading-pulse span:nth-child(3) {
  animation-delay: 0.32s;
}

/* Floating Scroll-to-Bottom Button */
.scroll-bottom-btn {
  position: absolute;
  right: 16px;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-accent);
  background: rgba(20, 22, 27, 0.94);
  color: var(--accent-hover);
  font-size: 0.78rem;
  font-weight: 600;
  box-shadow: var(--shadow-float);
  transition: transform 0.16s ease, background-color 0.16s ease;
}

.scroll-bottom-btn:hover {
  background: #232018;
  transform: translateY(-1px);
}

/* ==========================================================================
   Composer (Send as Tuan)
   ========================================================================== */

.composer {
  padding: 12px 12px 14px;
  border-top: 1px solid var(--border-subtle);
  background: #121419;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.composer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.composer-identity {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.composer-identity strong {
  color: var(--accent-hover);
  font-weight: 600;
}

.sender-badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.recipient-wrap {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.recipient-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.recipient-select-box {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.recipient-select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 34px;
  padding: 5px 28px 5px 11px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-medium);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.recipient-select:focus {
  border-color: var(--border-accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.composer-error {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: rgba(229, 100, 92, 0.12);
  border: 1px solid rgba(229, 100, 92, 0.3);
  color: #f6b0ab;
  font-size: 0.82rem;
}

.composer-input-row {
  display: flex;
  align-items: flex-end;
  gap: 9px;
}

.message-input {
  flex: 1;
  min-height: 52px;
  max-height: 150px;
  padding: 13px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-medium);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 16px; /* Phone-friendly: avoids viewport zoom */
  line-height: 1.45;
  resize: none;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.message-input::placeholder {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.message-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.send-btn {
  flex-shrink: 0;
  min-height: 52px;
  min-width: 86px;
  padding: 0 16px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.92rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  box-shadow: 0 6px 18px var(--accent-glow);
  transition: background-color 0.16s ease, transform 0.12s ease, opacity 0.16s ease, box-shadow 0.16s ease;
}

.send-btn:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 8px 22px rgba(229, 169, 60, 0.34);
}

.send-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.composer-hint {
  display: none;
}

.composer-hint kbd {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.poll-note {
  font-family: var(--font-mono);
  font-size: 0.69rem;
}

/* ==========================================================================
   Sidebar (Stats + Members Panel + How the Bridge Works)
   ========================================================================== */

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stat-card {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.side-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-card);
}

.side-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.side-card-title {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.side-card-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-hover);
  border: 1px solid rgba(229, 169, 60, 0.24);
}

.info-icon {
  color: var(--accent);
  flex-shrink: 0;
}

/* Members List */
.members-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.member-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 11px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.018);
  text-align: left;
  transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.12s ease;
}

.member-item:hover {
  background: var(--bg-hover);
  border-color: var(--border-medium);
}

.member-item:active {
  transform: scale(0.99);
}

.member-item.is-active {
  background: var(--accent-soft);
  border-color: var(--border-accent);
}

.member-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border: 1px solid var(--sender-border, var(--border-medium));
  background: var(--sender-soft, var(--bg-elevated));
  color: var(--sender-color, var(--accent));
}

.member-info {
  min-width: 0;
  flex: 1;
}

.member-name {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-joined {
  display: block;
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.member-filter-tag {
  font-size: 0.69rem;
  font-weight: 600;
  color: var(--accent-hover);
  flex-shrink: 0;
}

.members-empty {
  padding: 14px 12px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-medium);
  text-align: center;
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.members-footnote {
  margin: 12px 0 0;
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Bridge Info Card */
.bridge-info-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bridge-info-body p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.62;
  color: var(--text-secondary);
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulseDot {
  0%, 100% {
    opacity: 0.4;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1.15);
  }
}

@keyframes bounceFade {
  0%, 80%, 100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

/* ==========================================================================
   Tablet & Desktop Breakpoints
   ========================================================================== */

@media (min-width: 640px) {
  .header-inner {
    padding: 14px 22px;
  }

  .workspace {
    padding: 18px 20px 32px;
  }

  .filter-bar {
    padding: 14px 16px;
    gap: 10px;
  }

  .sender-select {
    max-width: 190px;
  }

  .message-feed {
    padding: 20px 18px 22px;
  }

  .composer {
    padding: 14px 16px 16px;
  }

  .composer-hint {
    display: inline;
  }

  .msg-row {
    max-width: 82%;
  }
}

@media (min-width: 960px) {
  .mobile-summary-bar {
    display: none;
  }

  .workspace {
    padding: 22px 24px 28px;
    grid-template-columns: minmax(0, 1fr) 340px;
    align-items: start;
    gap: 22px;
  }

  .chat-panel {
    height: calc(100dvh - 116px);
    min-height: 580px;
    max-height: 860px;
  }

  .message-feed {
    max-height: none;
    min-height: 0;
  }

  .sidebar {
    position: sticky;
    top: 86px;
  }

  .msg-row {
    max-width: 78%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
