/* Club chat — members + guest threads (pilot field backdrop + site tokens) */

.rcs-club-chat-page {
  --cc-accent: #38bdf8;
  --cc-accent-2: #22c55e;
  --cc-danger: #ef4444;
  --cc-bubble-me: rgba(14, 165, 233, 0.22);
  --cc-bubble-them: rgba(15, 23, 42, 0.72);
  --cc-panel: rgba(11, 18, 32, 0.82);
  --cc-rail: rgba(15, 23, 42, 0.72);
  --cc-chat-bg: transparent;
  --cc-border: rgba(148, 163, 184, 0.28);
  --cc-text: #f1f5f9;
  --cc-muted: #94a3b8;
  --cc-send: #38bdf8;
  /* Phone keeps this at 0. Desktop reserves the footer dock. */
  --cc-chrome: 0px;
  color: var(--cc-text);
}

html[data-theme="light"] .rcs-club-chat-page,
html:not([data-theme="dark"]) .rcs-club-chat-page {
  --cc-bubble-me: rgba(186, 230, 253, 0.88);
  --cc-bubble-them: rgba(255, 255, 255, 0.88);
  --cc-panel: rgba(255, 255, 255, 0.78);
  --cc-rail: rgba(241, 245, 249, 0.72);
  --cc-chat-bg: rgba(226, 232, 240, 0.55);
  --cc-border: rgba(15, 23, 42, 0.12);
  --cc-text: #0f172a;
  --cc-muted: #64748b;
  --cc-accent: #0f172a;
  --cc-send: #0284c7;
}

@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) .rcs-club-chat-page {
    --cc-bubble-me: rgba(186, 230, 253, 0.88);
    --cc-bubble-them: rgba(255, 255, 255, 0.88);
    --cc-panel: rgba(255, 255, 255, 0.78);
    --cc-rail: rgba(241, 245, 249, 0.72);
    --cc-chat-bg: rgba(226, 232, 240, 0.55);
    --cc-border: rgba(15, 23, 42, 0.12);
    --cc-text: #0f172a;
    --cc-muted: #64748b;
    --cc-accent: #0f172a;
    --cc-send: #0284c7;
  }
}

html[data-theme="dark"] .rcs-club-chat-page {
  --cc-bubble-me: rgba(14, 165, 233, 0.22);
  --cc-bubble-them: rgba(15, 23, 42, 0.72);
  --cc-panel: rgba(11, 18, 32, 0.82);
  --cc-rail: rgba(15, 23, 42, 0.72);
  --cc-chat-bg: transparent;
  --cc-border: rgba(148, 163, 184, 0.28);
  --cc-text: #f1f5f9;
  --cc-muted: #94a3b8;
  --cc-accent: #38bdf8;
  --cc-send: #38bdf8;
}

.rcs-club-chat-page .rcs-pilot-scene {
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

/* Page must not scroll — only #cc-messages scrolls when the thread is long */
body.rcs-club-chat-page.rcs-pilot-field-page,
body.rcs-club-chat-page {
  overflow: hidden !important;
  height: 100dvh;
  max-height: 100dvh;
  scrollbar-gutter: auto;
  padding-bottom: 0 !important;
}

html:has(body.rcs-club-chat-page) {
  overflow: hidden;
  height: 100%;
}

.rcs-cc-shell {
  position: relative;
  z-index: 1;
  width: min(1040px, calc(100% - 24px));
  max-width: 1040px;
  margin: 0 auto;
  height: calc(100dvh - var(--cc-chrome));
  max-height: calc(100dvh - var(--cc-chrome));
  display: flex;
  flex-direction: column;
  padding: 8px 0 0;
  box-sizing: border-box;
  overflow: hidden;
}

#chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
  gap: 6px;
  overflow: hidden;
}

.rcs-cc-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.rcs-cc-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.rcs-cc-brand h1 {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  font-weight: 750;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}

.rcs-cc-brand .rcs-hint {
  margin: 0;
  color: var(--cc-muted);
}

.rcs-cc-top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.rcs-cc-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  flex: 0 0 auto;
  padding: 0;
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--cc-border);
  border-radius: 0;
  background: var(--cc-panel);
  gap: 0;
}

.rcs-cc-tab {
  appearance: none;
  border: 0;
  border-right: 1px solid var(--cc-border);
  background: transparent;
  color: var(--cc-muted);
  font: inherit;
  font-weight: 700;
  padding: 12px 10px;
  border-radius: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
}

.rcs-cc-tab:last-child {
  border-right: 0;
}

.rcs-cc-tab__ico {
  display: inline-block;
  font-size: 1.1em;
  line-height: 1;
  filter: brightness(1.35) contrast(1.2) saturate(1.15);
}

html[data-theme="dark"] .rcs-cc-tab__ico,
html:not([data-theme="light"]) .rcs-cc-tab__ico {
  filter: brightness(1.55) contrast(1.25) saturate(1.2);
}

html[data-theme="light"] .rcs-cc-tab__ico {
  filter: none;
}

@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) .rcs-cc-tab__ico {
    filter: none;
  }
}

.rcs-cc-tab.is-active {
  background: color-mix(in srgb, var(--cc-accent) 16%, var(--cc-panel));
  color: var(--cc-text);
  box-shadow: inset 0 -3px 0 var(--cc-send, var(--cc-accent));
}

html[data-theme="light"] .rcs-cc-tab.is-active,
html:not([data-theme="dark"]) .rcs-cc-tab.is-active {
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
  box-shadow: inset 0 -3px 0 #0f172a;
}

html[data-theme="dark"] .rcs-cc-tab.is-active {
  background: rgba(56, 189, 248, 0.16);
  color: #f8fafc;
  box-shadow: inset 0 -3px 0 var(--cc-send, #38bdf8);
}

.rcs-cc-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  background: var(--cc-danger);
  color: #fff;
  line-height: 1;
}

/* Unread attention on Club / Field Ops CHAT launch buttons */
.rcs-cc-attn {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-left: 8px;
  border-radius: 50%;
  background: #22c55e;
  vertical-align: middle;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55);
  animation: rcs-cc-attn-pulse 1.5s ease-out infinite;
}

html[data-theme="light"] .rcs-cc-attn,
[data-theme="light"] .rcs-cc-attn {
  background: #ef4444;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55);
}

@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) .rcs-cc-attn {
    background: #ef4444;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55);
  }
}

@keyframes rcs-cc-attn-pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55);
  }
  70% {
    transform: scale(1.2);
    box-shadow: 0 0 0 10px rgba(34, 197, 94, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

html[data-theme="light"] {
  --rcs-cc-attn-pulse: #ef4444;
}

@keyframes rcs-cc-attn-pulse-light {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55);
  }
  70% {
    transform: scale(1.2);
    box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

html[data-theme="light"] .rcs-cc-attn,
[data-theme="light"] .rcs-cc-attn {
  animation-name: rcs-cc-attn-pulse-light;
}

@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) .rcs-cc-attn {
    animation-name: rcs-cc-attn-pulse-light;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rcs-cc-attn {
    animation: none;
  }
}

.rcs-cc-list-head {
  display: none;
}

/*
 * Guests = one card like Members: head is the top strip of the same panel,
 * not a floating island above separate panes.
 */
.rcs-cc-guests-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--cc-border);
  border-radius: 18px;
  background: var(--cc-panel);
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px);
}

html[data-theme="light"] .rcs-cc-guests-shell,
html:not([data-theme="dark"]) .rcs-cc-guests-shell {
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}

.rcs-cc-guests-shell > .rcs-cc-panel-head {
  flex: 0 0 auto;
  border-bottom: 1px solid var(--cc-border);
  background: var(--cc-panel);
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
}

html[data-theme="light"] .rcs-cc-guests-shell > .rcs-cc-panel-head,
html:not([data-theme="dark"]) .rcs-cc-guests-shell > .rcs-cc-panel-head {
  background: color-mix(in srgb, var(--cc-panel) 92%, transparent);
  backdrop-filter: blur(12px);
}

.rcs-cc-guests-shell > .rcs-cc-layout {
  flex: 1;
  min-height: 0;
  gap: 0;
}

.rcs-cc-guests-shell .rcs-cc-sidebar {
  border: 0;
  border-radius: 0;
  border-right: 1px solid var(--cc-border);
  box-shadow: none;
  backdrop-filter: none;
  max-height: none;
  min-height: 0;
  overflow-y: auto;
}

.rcs-cc-guests-shell .rcs-cc-panel {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  background: transparent;
}

@media (max-width: 819px) {
  .rcs-cc-guests-shell .rcs-cc-sidebar {
    border-right: 0;
  }
}

.rcs-cc-list-head__title {
  margin: 0;
  justify-self: center;
  font-weight: 750;
  font-size: 0.95rem;
  color: var(--cc-text);
}

.rcs-cc-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  overflow: hidden;
  align-content: start;
}

@media (min-width: 820px) {
  .rcs-cc-layout.is-split {
    grid-template-columns: 260px 1fr;
    align-content: stretch;
  }
}

.rcs-cc-sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--cc-border);
  border-radius: 16px;
  background: var(--cc-rail);
  overflow: auto;
  max-height: 28vh;
  min-height: 0;
  backdrop-filter: blur(12px);
}

@media (min-width: 820px) {
  .rcs-cc-sidebar {
    max-height: none;
    padding: 12px;
  }
}

/* Phone Guests: list OR chat — never stacked with a void between them */
@media (max-width: 819px) {
  .rcs-cc-layout.is-split {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .rcs-cc-layout.is-split .rcs-cc-sidebar {
    flex: 1 1 auto;
    max-height: none;
    min-height: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-top: 0;
  }

  .rcs-cc-layout.is-split:not(.has-thread) .rcs-cc-panel {
    display: none;
  }

  .rcs-cc-layout.is-split.has-thread .rcs-cc-sidebar {
    display: none;
  }

  .rcs-cc-layout.is-split.has-thread .rcs-cc-panel {
    flex: 1 1 auto;
    min-height: 0;
  }

  .rcs-cc-layout.is-split .rcs-cc-empty {
    margin: 24px auto;
  }
}

.rcs-cc-side-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--cc-border);
  border-radius: 14px;
  background: var(--cc-panel, rgba(15, 23, 42, 0.72));
  color: inherit;
  padding: 12px 14px;
  cursor: pointer;
  font: inherit;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
}

.rcs-cc-side-item:hover {
  border-color: rgba(56, 189, 248, 0.45);
}

.rcs-cc-side-item.is-active {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.65);
}

.rcs-cc-side-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.rcs-cc-side-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
}

.rcs-cc-side-card { cursor: default; }

.rcs-cc-side-open {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.rcs-cc-side-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
}

.rcs-cc-side-item strong {
  display: block;
  font-size: 0.98rem;
  line-height: 1.25;
}

.rcs-cc-side-chip {
  flex: 0 0 auto;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.22);
  color: var(--cc-muted, #94a3b8);
}

.rcs-cc-side-chip--pending {
  background: rgba(251, 191, 36, 0.22);
  color: #fbbf24;
}

.rcs-cc-side-chip--open {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}

.rcs-cc-side-chip--topic {
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 700;
}

[data-theme="light"] .rcs-cc-side-chip--topic {
  color: #1d4ed8;
}

.rcs-cc-side-meta {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--cc-muted);
  line-height: 1.35;
}

.rcs-cc-side-meta--new {
  color: #38bdf8;
  font-weight: 700;
}

.rcs-cc-panel {
  position: relative;
  flex: 1;
  min-height: 0;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--cc-border);
  border-radius: 18px;
  background: var(--cc-panel);
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px);
}

.rcs-cc-panel-head {
  display: grid;
  grid-template-columns: minmax(72px, 1fr) auto minmax(72px, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--cc-border);
  background: var(--cc-panel);
  min-height: 56px;
}

/* Visuals: .rcs-cc-back / .rcs-back-btn in rcs-theme.css — keep chat tap target */
.rcs-cc-back {
  justify-self: start;
  min-width: 48px;
  min-height: 48px;
}

.rcs-cc-panel-head__brand {
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
  max-width: min(420px, 70vw);
  text-align: center;
}

.rcs-cc-panel-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  line-height: 0;
}

.rcs-cc-panel-logo img {
  height: 22px;
  width: auto;
  display: block;
}

.rcs-cc-panel-logo .rcs-cc-logo--light {
  display: none;
}

html[data-theme="light"] .rcs-cc-panel-logo .rcs-cc-logo--dark,
html:not([data-theme="dark"]) .rcs-cc-panel-logo .rcs-cc-logo--dark {
  display: none;
}

html[data-theme="light"] .rcs-cc-panel-logo .rcs-cc-logo--light,
html:not([data-theme="dark"]) .rcs-cc-panel-logo .rcs-cc-logo--light {
  display: block;
}

html[data-theme="dark"] .rcs-cc-panel-logo .rcs-cc-logo--dark {
  display: block;
}

html[data-theme="dark"] .rcs-cc-panel-logo .rcs-cc-logo--light {
  display: none;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .rcs-cc-panel-logo .rcs-cc-logo--dark {
    display: block;
  }
  html:not([data-theme="light"]) .rcs-cc-panel-logo .rcs-cc-logo--light {
    display: none;
  }
}

.rcs-cc-panel-head__sub {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--cc-muted);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.rcs-cc-status-quiet {
  font-size: inherit;
  font-weight: 750;
  color: #f59e0b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.rcs-cc-head-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.rcs-cc-end-visit {
  appearance: none;
  border: 1px solid var(--cc-border);
  background: color-mix(in srgb, var(--cc-rail) 70%, transparent);
  color: var(--cc-text);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
  padding: 8px 10px;
  min-height: 40px;
  border-radius: 10px;
  cursor: pointer;
}

.rcs-cc-end-visit:hover,
.rcs-cc-end-visit:focus-visible {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(56, 189, 248, 0.14);
}

.rcs-cc-menu {
  position: relative;
  flex: 0 0 auto;
}

.rcs-cc-head-spacer {
  justify-self: end;
  width: 40px;
  height: 40px;
}

.rcs-cc-menu-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--cc-text);
  width: 40px;
  height: 40px;
  border-radius: 999px;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  font-weight: 700;
}

.rcs-cc-menu-btn:hover {
  background: color-mix(in srgb, var(--cc-rail) 80%, transparent);
}

.rcs-cc-menu-panel {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 20;
  min-width: 220px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid var(--cc-border);
  background: var(--cc-panel);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  display: grid;
  gap: 4px;
}

.rcs-cc-menu-panel[hidden] {
  display: none !important;
}

.rcs-cc-menu-item {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--cc-text);
  text-align: left;
  font: inherit;
  font-size: 0.9rem;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
}

.rcs-cc-menu-item:hover {
  background: color-mix(in srgb, var(--cc-rail) 70%, transparent);
}

.rcs-cc-menu-item--danger {
  color: #f87171;
  font-weight: 800;
  margin-top: 4px;
  border-top: 1px solid var(--cc-border);
  border-radius: 0 0 8px 8px;
}

.rcs-cc-menu-item--danger:hover {
  background: rgba(239, 68, 68, 0.16);
}

.rcs-cc-menu-panel .rcs-check {
  padding: 8px 10px;
  margin: 0 0 4px;
}

.rcs-cc-me-bar {
  padding: 6px 12px;
  border-bottom: 1px solid var(--cc-border);
  background: var(--cc-rail);
}

.rcs-cc-me-appear {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--cc-muted);
}

.rcs-cc-me-label {
  font-weight: 600;
}

.rcs-cc-me-name {
  color: var(--cc-text);
  font-weight: 800;
  letter-spacing: -0.01em;
}

.rcs-cc-role-pill {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(234, 179, 8, 0.22);
  border: 1px solid rgba(234, 179, 8, 0.45);
  color: var(--cc-text);
}

.rcs-cc-anon {
  font-size: 0.85rem;
  opacity: 0.85;
}

.rcs-cc-messages {
  flex: 1;
  overflow: auto;
  padding: 12px 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  background: var(--cc-chat-bg, transparent);
}

/* Aviation hazard-tape day divider — tape = half label height; date plate unchanged */
.rcs-cc-day {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  width: 100%;
  max-width: 100%;
  margin: 12px 0 6px;
}

.rcs-cc-day::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 50%;
  transform: translateY(-50%);
  border: 1px solid #111;
  border-radius: 2px;
  background: repeating-linear-gradient(
    -45deg,
    #111 0 8px,
    #f5c518 8px 16px
  );
  /* Inner black frame — merges into the date plate */
  box-shadow: inset 0 0 0 2px #111;
  z-index: 0;
  pointer-events: none;
}

.rcs-cc-day__label {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 5px 14px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.35;
  color: #f5c518;
  background: #111;
  border: none;
  border-radius: 999px;
  /* Soft join into the tape */
  box-shadow: -2px 0 0 #111, 2px 0 0 #111;
  white-space: nowrap;
  text-align: center;
}

@media (max-width: 420px) {
  .rcs-cc-day__label {
    white-space: normal;
    max-width: min(72vw, 220px);
  }
}

html[data-theme="light"] .rcs-cc-panel,
html:not([data-theme="dark"]) .rcs-cc-panel {
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}

html[data-theme="light"] .rcs-cc-panel-head,
html[data-theme="light"] .rcs-cc-composer,
html:not([data-theme="dark"]) .rcs-cc-panel-head,
html:not([data-theme="dark"]) .rcs-cc-composer {
  background: color-mix(in srgb, var(--cc-panel) 92%, transparent);
  backdrop-filter: blur(12px);
}

.rcs-cc-bubble {
  max-width: min(88%, 480px);
  padding: 8px 10px 6px;
  border-radius: 14px;
  background: var(--cc-bubble-them);
  border: 1px solid var(--cc-border);
  align-self: flex-start;
  color: var(--cc-text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.rcs-cc-bubble.is-me {
  align-self: flex-end;
  background: var(--cc-bubble-me);
  border-bottom-right-radius: 4px;
  border-color: color-mix(in srgb, var(--cc-send, var(--cc-accent)) 40%, var(--cc-border));
}

.rcs-cc-bubble.is-them {
  border-bottom-left-radius: 4px;
}

.rcs-cc-bubble.is-hidden {
  opacity: 0.55;
  font-style: italic;
}

.rcs-cc-bubble-name {
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--cc-muted);
}

.rcs-cc-bubble-body {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.4;
  font-size: 0.95rem;
  color: var(--cc-text);
}

.rcs-cc-bubble-body a {
  color: var(--cc-text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

html[data-theme="dark"] .rcs-cc-bubble-body a {
  color: #7dd3fc;
}

.rcs-cc-bubble-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
  font-size: 0.7rem;
  color: var(--cc-muted);
  position: relative;
}

.rcs-cc-admin {
  position: relative;
  margin-left: auto;
}

.rcs-cc-admin-btn {
  appearance: none;
  border: 1px solid var(--cc-border);
  background: color-mix(in srgb, var(--cc-rail) 70%, transparent);
  color: var(--cc-muted);
  font: inherit;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1.2;
}

.rcs-cc-admin-btn:hover,
.rcs-cc-admin.is-open .rcs-cc-admin-btn {
  color: var(--cc-text);
  border-color: color-mix(in srgb, var(--cc-text) 25%, var(--cc-border));
}

.rcs-cc-admin-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  z-index: 30;
  min-width: 168px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--cc-border);
  background: var(--cc-panel);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  display: grid;
  gap: 2px;
  backdrop-filter: blur(12px);
}

.rcs-cc-bubble.is-them .rcs-cc-admin-menu {
  right: auto;
  left: 0;
}

.rcs-cc-admin-menu[hidden] {
  display: none !important;
}

.rcs-cc-admin-item {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--cc-text);
  text-align: left;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.rcs-cc-admin-item:hover {
  background: color-mix(in srgb, var(--cc-rail) 80%, transparent);
}

.rcs-cc-bubble-img-btn {
  appearance: none;
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 6px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  border-radius: 12px;
  overflow: hidden;
}

.rcs-cc-bubble-img-btn:focus-visible {
  outline: 2px solid var(--cc-accent);
  outline-offset: 2px;
}

.rcs-cc-bubble-img {
  display: block;
  max-width: 100%;
  max-height: 240px;
  border-radius: 12px;
  margin: 0;
  cursor: zoom-in;
}

.rcs-cc-composer {
  border-top: 1px solid var(--cc-border);
  padding: 6px 10px calc(8px + var(--rcs-safe-bottom, env(safe-area-inset-bottom, 0px)));
  display: grid;
  gap: 6px;
  background: var(--cc-panel);
}

.rcs-cc-flash {
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.35;
  background: color-mix(in srgb, var(--cc-rail) 85%, transparent);
  border: 1px solid var(--cc-border);
  color: var(--cc-text);
}

.rcs-cc-flash.is-err {
  background: color-mix(in srgb, var(--cc-danger, #ef4444) 18%, var(--cc-panel));
  border-color: color-mix(in srgb, var(--cc-danger, #ef4444) 45%, var(--cc-border));
  color: var(--cc-text);
}

.rcs-cc-flash.is-ok {
  background: color-mix(in srgb, var(--cc-accent-2, #22c55e) 16%, var(--cc-panel));
  border-color: color-mix(in srgb, var(--cc-accent-2, #22c55e) 40%, var(--cc-border));
}

.rcs-cc-pending {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--cc-send, var(--cc-accent)) 45%, var(--cc-border));
  background: color-mix(in srgb, var(--cc-send, var(--cc-accent)) 12%, var(--cc-rail));
}

.rcs-cc-pending__thumb {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 10px;
  background: var(--cc-rail);
}

.rcs-cc-pending__meta {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.rcs-cc-pending__meta strong {
  font-size: 0.88rem;
}

.rcs-cc-pending__meta .rcs-hint {
  margin: 0;
  font-size: 0.78rem;
}

.rcs-cc-pending__clear {
  appearance: none;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--cc-rail) 70%, transparent);
  color: var(--cc-text);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.rcs-cc-pending__clear:hover {
  background: color-mix(in srgb, var(--cc-danger, #ef4444) 25%, var(--cc-rail));
}

.rcs-club-chat-page label.rcs-cc-attach.is-armed {
  border-color: color-mix(in srgb, var(--cc-send, var(--cc-accent)) 55%, var(--cc-border));
  background: color-mix(in srgb, var(--cc-send, var(--cc-accent)) 22%, var(--cc-rail));
}

.rcs-club-chat-page .rcs-cc-send.is-armed {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--cc-send, var(--cc-accent)) 55%, transparent);
}

.rcs-cc-composer-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.rcs-cc-composer textarea {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  max-height: 120px;
  resize: none;
  border-radius: 22px;
  border: 1px solid var(--cc-border);
  background: var(--cc-rail);
  color: var(--cc-text);
  padding: 11px 14px;
  font: inherit;
  font-size: 1rem;
  line-height: 1.35;
  width: auto;
}

.rcs-cc-composer textarea::placeholder {
  color: var(--cc-muted);
}

.rcs-cc-emoji-bar {
  display: flex;
  gap: 4px;
  padding: 0 2px;
}

.rcs-cc-emoji {
  appearance: none;
  border: 0;
  background: transparent;
  border-radius: 10px;
  width: 40px;
  height: 36px;
  font-size: 1.35rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.rcs-cc-emoji:hover,
.rcs-cc-emoji:focus-visible {
  background: color-mix(in srgb, var(--cc-rail) 70%, transparent);
}

/* Beat .rcs-pilot-page label / input form chrome */
.rcs-club-chat-page label.rcs-cc-attach {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
  width: 44px !important;
  height: 44px;
  min-width: 44px;
  max-width: 44px;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 999px;
  border: 1px solid var(--cc-border);
  background: color-mix(in srgb, var(--cc-rail) 80%, transparent);
  color: var(--cc-text);
  font-size: 0 !important;
  line-height: 0;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  box-sizing: border-box;
}

.rcs-club-chat-page label.rcs-cc-attach:hover {
  background: color-mix(in srgb, var(--cc-rail) 95%, var(--cc-accent));
}

.rcs-club-chat-page .rcs-cc-attach__svg {
  display: block;
  width: 22px;
  height: 22px;
  pointer-events: none;
  flex: 0 0 auto;
}

.rcs-club-chat-page label.rcs-cc-attach input[type="file"] {
  position: absolute !important;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  opacity: 0;
  cursor: pointer;
  font-size: 0 !important;
  color: transparent;
}

.rcs-club-chat-page .rcs-cc-send {
  appearance: none;
  border: 0;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  margin: 0;
  background: var(--cc-send, var(--cc-accent));
  color: #0b1220;
  line-height: 0;
}

.rcs-club-chat-page .rcs-cc-send svg {
  display: block;
  width: 20px;
  height: 20px;
}

.rcs-club-chat-page .rcs-cc-send:hover {
  filter: brightness(1.08);
}

.rcs-cc-disclaimer {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(2, 6, 23, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.rcs-cc-disclaimer-card {
  max-width: 520px;
  width: 100%;
  border-radius: 18px;
  background: var(--cc-panel);
  color: var(--cc-text);
  border: 1px solid var(--cc-border);
  padding: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(16px);
}

.rcs-cc-disclaimer-card h2 {
  margin: 0 0 10px;
}

.rcs-cc-disclaimer-card ul {
  margin: 0 0 16px;
  padding-left: 1.1rem;
  color: var(--cc-muted);
  line-height: 1.45;
}

.rcs-cc-empty {
  margin: auto;
  text-align: center;
  padding: 40px 20px;
  color: var(--cc-muted);
}

.rcs-cc-empty .emoji {
  font-size: 2rem;
  display: block;
  margin-bottom: 8px;
}

.rcs-cc-guest-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 10px;
}

.rcs-club-chat-page .rcs-page-auth .rcs-card,
.rcs-club-chat-page .rcs-page-loading {
  position: relative;
  z-index: 1;
  background: var(--cc-panel);
  border: 1px solid var(--cc-border);
  border-radius: 16px;
  padding: 20px;
  backdrop-filter: blur(12px);
}

@keyframes rcs-cc-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Phone: near full-screen chat column */
@media (max-width: 720px) {
  .rcs-cc-shell {
    width: 100%;
    max-width: none;
    padding: 0;
    height: calc(100dvh - var(--cc-chrome));
    max-height: calc(100dvh - var(--cc-chrome));
  }

  #chat-main {
    gap: 0;
  }

  .rcs-cc-tabs {
    margin: 0;
    border-radius: 0;
  }

  .rcs-cc-layout {
    flex: 1;
    min-height: 0;
    border-radius: 0;
  }

  .rcs-cc-panel {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    box-shadow: none;
  }

  /* Guest shell must match Members: flush under the tabs (no rounded top gap). */
  .rcs-cc-guests-shell {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    box-shadow: none;
  }

  .rcs-cc-panel-head {
    padding: 6px 8px;
  }

  .rcs-cc-composer {
    padding: 4px 8px calc(6px + var(--rcs-safe-bottom, env(safe-area-inset-bottom, 0px)));
    gap: 4px;
  }
}

/* Donate chip and the first-visit menu hint stay off the chat column. */
body.rcs-club-chat-page .rcs-donate-chip-wrap,
body.rcs-club-chat-page .rcs-footer-menu-hint {
  display: none !important;
}

/* Desktop keeps the club topper and the footer dock. Phone stays full screen. */
body.rcs-club-chat-page.rcs-pilot-page .rcs-pilot-scene {
  padding-top: 0;
}

@media (min-width: 721px) {
  body.rcs-club-chat-page {
    --cc-chrome: calc(var(--rcs-pilot-topper-h, 56px) + 10px + 72px + var(--rcs-safe-bottom, env(safe-area-inset-bottom, 0px)));
  }

  body.rcs-club-chat-page .rcs-cc-back {
    display: none;
  }
}

@media (max-width: 720px) {
  body.rcs-club-chat-page .rcs-pilot-chrome {
    display: none !important;
  }
}

@media (max-width: 720px) {
  body.rcs-club-chat-page .rcs-footer-page {
    display: none !important;
  }
}

/* Keyboard open: pin shell to visual viewport */
body.rcs-cc-typing.rcs-club-chat-page,
body.rcs-cc-typing.rcs-club-chat-page.rcs-pilot-field-page {
  padding-bottom: 0 !important;
}

body.rcs-cc-typing .rcs-cc-shell {
  position: fixed;
  top: var(--cc-vv-offset, 0px);
  left: 0;
  right: 0;
  width: 100%;
  max-width: none;
  height: var(--cc-vv-h, 100dvh);
  max-height: var(--cc-vv-h, 100dvh);
  z-index: 60;
  padding: 0;
  margin: 0;
  --cc-chrome: 0px;
}

body.rcs-cc-typing .rcs-cc-composer {
  padding-bottom: 6px;
}

body.rcs-cc-typing .rcs-cc-panel {
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
}

body.rcs-cc-typing .rcs-cc-guests-shell {
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  box-shadow: none;
}

/* —— Members search (WhatsApp-style) —— */
.rcs-cc-search-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--cc-text);
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
}

.rcs-cc-search-btn:hover,
.rcs-cc-search-btn:focus-visible {
  background: color-mix(in srgb, var(--cc-rail) 80%, transparent);
  outline: none;
}

.rcs-cc-history-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--cc-border);
  background: color-mix(in srgb, var(--cc-rail) 55%, var(--cc-panel));
  font-size: 0.78rem;
  color: var(--cc-muted);
  flex: 0 0 auto;
}

.rcs-cc-history-latest {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--cc-accent, #38bdf8);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
  white-space: nowrap;
}

.rcs-cc-history-latest:hover {
  text-decoration: underline;
}

.rcs-cc-bubble--flash {
  animation: rcs-cc-bubble-flash 1.8s ease-out;
}

@keyframes rcs-cc-bubble-flash {
  0%,
  35% {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--cc-accent, #38bdf8) 70%, transparent);
    background: color-mix(in srgb, var(--cc-accent, #38bdf8) 18%, var(--cc-panel));
  }
  100% {
    box-shadow: none;
  }
}

.rcs-cc-search {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  /* Opaque — do not use translucent --cc-panel */
  background: #0b1220;
  color: var(--cc-text);
}

html[data-theme="light"] .rcs-cc-search,
html:not([data-theme="dark"]) .rcs-cc-search {
  background: #f8fafc;
}

html[data-theme="dark"] .rcs-cc-search {
  background: #0b1220;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .rcs-cc-search {
    background: #0b1220;
  }
}

.rcs-cc-search__bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--cc-border);
  flex: 0 0 auto;
}

.rcs-cc-search__back {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--cc-text);
  width: 40px;
  height: 40px;
  border-radius: 999px;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  flex: 0 0 auto;
}

.rcs-cc-search__back:hover {
  background: color-mix(in srgb, var(--cc-rail) 80%, transparent);
}

.rcs-cc-search__input {
  flex: 1;
  min-width: 0;
  appearance: none;
  border: 1px solid var(--cc-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--cc-rail) 70%, var(--cc-panel));
  color: var(--cc-text);
  font: inherit;
  font-size: 0.95rem;
  padding: 10px 14px;
}

.rcs-cc-search__input:focus {
  outline: 2px solid color-mix(in srgb, var(--cc-accent, #38bdf8) 55%, transparent);
  outline-offset: 1px;
}

.rcs-cc-search__clear {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--cc-muted);
  width: 36px;
  height: 36px;
  border-radius: 999px;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
}

.rcs-cc-search__chips,
.rcs-cc-search__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px 0;
  flex: 0 0 auto;
}

.rcs-cc-search__filters {
  padding-top: 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--cc-border);
}

.rcs-cc-search__chip {
  appearance: none;
  border: 1px solid var(--cc-border);
  background: color-mix(in srgb, var(--cc-rail) 50%, transparent);
  color: var(--cc-text);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 650;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.rcs-cc-search__chip--soft {
  font-weight: 600;
  opacity: 0.92;
}

.rcs-cc-search__chip.is-active {
  border-color: color-mix(in srgb, var(--cc-accent, #38bdf8) 55%, var(--cc-border));
  background: color-mix(in srgb, var(--cc-accent, #38bdf8) 22%, var(--cc-panel));
  color: var(--cc-text);
}

.rcs-cc-search__from-panel {
  max-height: 36%;
  overflow: auto;
  border-bottom: 1px solid var(--cc-border);
  padding: 4px 0;
  flex: 0 0 auto;
}

.rcs-cc-search__from-item {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--cc-text);
  font: inherit;
  font-size: 0.9rem;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  cursor: pointer;
}

.rcs-cc-search__from-item:hover,
.rcs-cc-search__from-item.is-active {
  background: color-mix(in srgb, var(--cc-rail) 70%, transparent);
}

.rcs-cc-search__body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.rcs-cc-search__empty {
  margin: 0;
  padding: 28px 18px;
  text-align: center;
  color: var(--cc-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.rcs-cc-search__list {
  display: flex;
  flex-direction: column;
}

.rcs-cc-search__row {
  appearance: none;
  border: 0;
  border-bottom: 1px solid var(--cc-border);
  background: transparent;
  color: var(--cc-text);
  font: inherit;
  text-align: left;
  padding: 12px 14px;
  cursor: pointer;
  width: 100%;
}

.rcs-cc-search__row:hover {
  background: color-mix(in srgb, var(--cc-rail) 55%, transparent);
}

.rcs-cc-search__row-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.rcs-cc-search__row-top strong {
  font-size: 0.92rem;
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rcs-cc-search__row-top span {
  flex: 0 0 auto;
  font-size: 0.72rem;
  color: var(--cc-muted);
}

.rcs-cc-search__link {
  font-size: 0.84rem;
  font-weight: 650;
  color: var(--cc-accent, #38bdf8);
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rcs-cc-search__snippet {
  font-size: 0.84rem;
  color: var(--cc-muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rcs-cc-search-mark {
  background: color-mix(in srgb, #fbbf24 55%, transparent);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

html[data-theme="light"] .rcs-cc-search-mark,
html:not([data-theme="dark"]) .rcs-cc-search-mark {
  background: color-mix(in srgb, #f59e0b 45%, #fff);
}

.rcs-cc-search__thumb-wrap {
  margin-top: 6px;
}

.rcs-cc-search__thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}

.rcs-cc-search__media {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 2px;
}

@media (min-width: 520px) {
  .rcs-cc-search__media {
    grid-template-columns: repeat(4, 1fr);
  }
}

.rcs-cc-search__media-item {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: color-mix(in srgb, var(--cc-rail) 60%, transparent);
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
}

.rcs-cc-search__media-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
