/* Temporary Social Night / tour chat panel */
.fn-chat {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 1rem;
  padding: 0.85rem 0.9rem 0.95rem;
  border: 1px solid color-mix(in srgb, currentColor 14%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--fn-bg, #050608) 88%, #1a1d24);
  min-height: 14rem;
  max-height: 22rem;
  /* Keep composer pinned; only messages scroll */
  overflow: hidden;
}

.fn-chat-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  flex-shrink: 0;
}

.fn-chat-status-bar {
  flex-shrink: 0;
}

.fn-chat-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.fn-chat-status {
  margin: 0;
  font-size: 0.78rem;
  opacity: 0.75;
}

.fn-chat-status[data-kind="closed"],
.fn-chat-status[data-kind="error"] {
  color: var(--fn-red, #ff6b6b);
  opacity: 1;
}

.fn-chat-status[data-kind="warn"] {
  color: #fbbf24;
  opacity: 1;
}

.fn-chat-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.15rem 0.1rem;
}

.fn-chat-empty {
  margin: 1rem 0;
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.65;
}

.fn-chat-msg {
  max-width: 92%;
  align-self: flex-start;
}

.fn-chat-msg.is-mine {
  align-self: flex-end;
}

.fn-chat-msg-meta {
  display: flex;
  gap: 0.45rem;
  align-items: baseline;
  margin-bottom: 0.15rem;
  font-size: 0.72rem;
  opacity: 0.7;
}

.fn-chat-msg-text {
  margin: 0;
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  background: color-mix(in srgb, currentColor 10%, transparent);
  font-size: 0.9rem;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}

.fn-chat-msg.is-mine .fn-chat-msg-text {
  background: color-mix(in srgb, var(--fn-accent, #7c5cff) 28%, transparent);
}

.fn-chat-composer {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  flex-shrink: 0;
  margin-top: auto;
}

.fn-chat-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid color-mix(in srgb, currentColor 18%, transparent);
  border-radius: var(--fn-radius-control, 6px);
  background: transparent;
  color: inherit;
  padding: 0.55rem 0.85rem;
  font: inherit;
  font-size: 0.9rem;
}

.fn-chat-input:disabled {
  opacity: 0.55;
}

.fn-chat-send {
  flex: 0 0 auto;
  border: 0;
  border-radius: var(--fn-radius-control, 6px);
  padding: 0.55rem 0.95rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: #0b0c10;
  background: var(--fn-accent, #c4b5fd);
}

.fn-chat-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.fn-chat.is-readonly .fn-chat-composer {
  display: none;
}

.fn-chat-auth-prompt {
  max-width: 100%;
  align-self: stretch;
}

.fn-chat-auth-prompt .fn-chat-msg-text {
  background: color-mix(in srgb, var(--fn-accent, #7c5cff) 16%, transparent);
}

.fn-chat-auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.55rem;
}

.fn-chat-auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.4rem;
  padding: 0.4rem 0.9rem;
  border-radius: var(--fn-radius-control, 6px);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.fn-chat-auth-btn.is-primary {
  background: var(--fn-accent, #7c5cff);
  color: #fff;
  border: 1px solid transparent;
}

.fn-chat-auth-btn.is-primary:hover {
  filter: brightness(1.08);
}

.fn-chat-auth-btn.is-secondary {
  background: transparent;
  color: inherit;
  border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
}

.fn-chat-auth-btn.is-secondary:hover {
  background: color-mix(in srgb, currentColor 8%, transparent);
}

.society-tours-detail .fn-chat {
  margin-top: 0.85rem;
  max-height: 18rem;
}

.fn-chat-msg-author-wrap {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  min-width: 0;
}

a.fn-chat-msg-author {
  color: inherit;
  text-decoration: none;
  font-weight: inherit;
}

a.fn-chat-msg-author:hover {
  text-decoration: underline;
}

.fn-chat-msg-fn {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  opacity: 0.95;
}

.fn-chat-msg-fn .fn-rating-badge {
  --fn-badge-h: 1.2rem;
}

.fn-chat-msg-fn .fn-rating-mark {
  font-size: 0.85em;
}

.fn-chat-msg-fn .fn-rating-mark.is-xs {
  font-size: 0.68em;
  letter-spacing: -0.04em;
}

@media (max-width: 719px) {
  .fn-chat {
    max-height: min(50vh, 22rem);
  }
}
