/**
 * File: support.css
 * Purpose: Styles the User Support and Chat interface, including conversation threads, 
 * message bubbles, and input areas for customer service interactions.
 */
/* ════════════════════════════════════════════════════════════
   support.css — AffairOva User Support Page
   Chat-based support matching the support-center.html visual
   language. Design tokens live in base.css.
   ════════════════════════════════════════════════════════════ */

/* ── PAGE WRAPPER ─────────────────────────────────────────── */
.support-page {
  width: 100%;
  padding: 16px 16px 60px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

@media (min-width: 768px) {
  .support-page { padding: 28px 24px 80px; }
}

@media (min-width: 1024px) {
  .support-page {
    padding: 32px 32px 80px;
  }
}

/* ── SCROLL LOCK — body stops scrolling behind chat ─────────
   Only applied on mobile (<1024px). Desktop uses a fixed-height
   card instead (see @media block at bottom).                   */
body.sp-lock-scroll {
  overflow: hidden;
}

/* ── SCREEN SWITCH ────────────────────────────────────────── */
.sp-screen           { display: none; flex-direction: column; }
.sp-screen.is-active { display: flex; }

/* ── CHAT SCREEN — MOBILE: position:fixed full-screen ───────
   The most reliable way to pin the input bar at the bottom on
   every device/browser. The chat screen is lifted out of the
   normal flow and covers the entire viewport.                  */
#sp-chat {
  min-height: 0;
}

/* ── MOBILE chat: fixed below 56px site header ──────────────
   z-index 199 keeps it under the header (z-index:200) so the
   header stays fully visible at all times.                     */
@media (max-width: 1023px) {
  #sp-chat.is-active {
    position: fixed;
    top: 56px;          /* ao-header-inner mobile height         */
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 199;
    background: var(--bg, #f5f7fa);
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
  }

  #sp-chat .sp-sub-header {
    flex-shrink: 0;
    padding: 14px 16px 12px;
    margin-bottom: 0;
    background: var(--bg, #f5f7fa);
    border-bottom: 1.5px solid var(--card-border);
  }

  #sp-chat .sp-chat-body {
    flex: 1;
    min-height: 0;
    padding: 10px 16px 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  #sp-chat .sp-chat-closed-bar {
    flex-shrink: 0;
    margin: 0;
    border-radius: 0;
    padding: 12px 16px;
  }

  #sp-chat .sp-chat-input-bar {
    flex-shrink: 0;
    margin: 0;
    border-radius: 16px 16px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    padding: 10px 12px 10px 16px;
    box-shadow: 0 -2px 12px rgba(20,30,70,.06);
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }
}

/* ── SUB-SCREEN HEADER (Chat / Privacy / Terms) ──────────── */
.sp-sub-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1.5px solid var(--card-border);
  flex-shrink: 0;
}

.sp-back-btn {
  width: 36px; height: 36px;
  min-width: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.6);
  background: linear-gradient(180deg, rgba(255,255,255,0.78) 0%, rgba(255,255,255,0.55) 100%);
  backdrop-filter: blur(10px) saturate(150%);
  -webkit-backdrop-filter: blur(10px) saturate(150%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.85);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--ink);
  transition: background 0.2s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.sp-back-btn:hover { background: rgba(255,255,255,0.9); transform: translateY(-1px); }
.sp-back-btn svg   { width: 18px; height: 18px; }

.sp-sub-icon {
  width: 38px; height: 38px;
  min-width: 38px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sp-sub-icon svg { width: 18px; height: 18px; }

.sp-sub-info { flex: 1; min-width: 0; }
.sp-sub-info h2 {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.15px;
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sp-sub-info p {
  font-size: 11px;
  color: var(--muted);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Sub-screen entrance (Chat / Privacy / Terms) ───────────── */
.sp-back-btn  { animation: spZoomIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) 0.04s both; }
.sp-sub-icon  { animation: spZoomIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) 0.10s both; }
.sp-sub-info  { animation: spZoomIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) 0.14s both; }

/* ── ICON COLOUR VARIANTS ─────────────────────────────────── */
.sp-ic-green  { background: var(--green-soft);  color: var(--green-soft-text);  }
.sp-ic-orange { background: var(--orange-soft); color: var(--orange-soft-text); }
.sp-ic-blue   { background: var(--blue-soft);   color: var(--blue-soft-text);   }
.sp-ic-purple { background: var(--purple-soft); color: var(--purple-soft-text); }

/* ════════════════════════════════════════════════════════════
   SUPPORT HUB SCREEN
   ════════════════════════════════════════════════════════════ */

/* ── Hub header ───────────────────────────────────────────── */
.sp-hub-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.sp-hub-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sp-title-icon {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: var(--ink);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sp-title-icon svg { width: 18px; height: 18px; }

.sp-hub-title h1 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.3px;
  margin: 0 0 2px;
}
.sp-hub-title p {
  font-size: 11.5px;
  color: var(--muted);
  margin: 0;
}

.sp-user-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--blue-soft);
  border: 2px solid var(--blue);
  color: var(--blue-soft-text);
  font-size: 12.5px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}

/* ── Hero banner ──────────────────────────────────────────── */
.sp-hero-banner {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 60%, #3b82f6 100%);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
  box-shadow: 0 8px 24px rgba(37,99,235,.22);
}

.sp-hero-icon {
  width: 44px; height: 44px;
  min-width: 44px;
  border-radius: 13px;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.25);
  backdrop-filter: blur(6px) saturate(140%);
  -webkit-backdrop-filter: blur(6px) saturate(140%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sp-hero-icon svg { width: 24px; height: 24px; stroke: #ffffff; }

.sp-hero-text { flex: 1; min-width: 0; }
.sp-hero-title {
  font-size: 14.5px;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 4px;
}
.sp-hero-sub {
  font-size: 11.5px;
  color: rgba(255,255,255,.78);
  margin: 0;
  line-height: 1.4;
}

.sp-hero-cta {
  flex-shrink: 0;
  height: 36px;
  padding: 0 18px;
  border-radius: 99px;
  border: none;
  background: #ffffff;
  color: var(--blue);
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease;
  white-space: nowrap;
}
.sp-hero-cta:hover  { background: #e7edff; }
.sp-hero-cta:active { transform: scale(0.96); }

/* ── Section labels ───────────────────────────────────────── */
.sp-section-label {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
}

/* ── List card ────────────────────────────────────────────── */
.sp-list-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.78) 0%, rgba(255,255,255,0.55) 100%);
  border: 1px solid rgba(255,255,255,0.6);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-radius: 18px;
  overflow: hidden;
  margin-bottom: 18px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.85),
    inset 0 -1px 1px rgba(20,30,70,0.03),
    0 4px 16px rgba(20,30,70,0.05);
}

.sp-list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.5);
  cursor: pointer;
  color: var(--ink);
  transition: background 0.2s cubic-bezier(0.22, 1, 0.36, 1),
              backdrop-filter 0.2s ease;
  text-decoration: none;
}
.sp-list-row:last-child  { border-bottom: none; }
.sp-list-row:hover {
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(6px) saturate(150%);
  -webkit-backdrop-filter: blur(6px) saturate(150%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}
.sp-list-row:active { background: rgba(255,255,255,0.75); }

.sp-row-icon {
  width: 36px; height: 36px;
  min-width: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sp-row-icon svg { width: 16px; height: 16px; }

.sp-row-text { flex: 1; min-width: 0; }
.sp-row-title {
  font-size: 12.5px;
  font-weight: 700;
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sp-row-sub {
  font-size: 11px;
  color: var(--muted);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sp-row-chevron {
  flex-shrink: 0;
  color: var(--muted);
}
.sp-row-chevron svg { width: 16px; height: 16px; }

/* ── Trust banner ─────────────────────────────────────────── */
.sp-trust-inline {
  margin-top: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.sp-trust-icon {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sp-trust-icon--green  { background: var(--green-soft);  color: var(--green-soft-text); }
.sp-trust-icon--orange { background: var(--orange-soft); color: var(--orange-soft-text); }
.sp-trust-icon--blue   { background: var(--blue-soft);   color: var(--blue-soft-text); }

/* ── Hub entrance animations (mirrors header.css aoZoomIn/aoHeaderDrop) ── */
@keyframes spZoomIn {
  from { opacity: 0; transform: scale(0.94) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

#sp-hub .sp-hero-banner {
  animation: spZoomIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) 0.08s both;
}
#sp-hub .sp-hub-grid > div:nth-child(1) .sp-list-card {
  animation: spZoomIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) 0.16s both;
}
#sp-hub .sp-hub-grid > div:nth-child(2) .sp-list-card {
  animation: spZoomIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) 0.22s both;
}
#sp-hub .sp-trust-inline {
  animation: spZoomIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) 0.28s both;
}


/* ════════════════════════════════════════════════════════════
   LIVE CHAT SCREEN
   ════════════════════════════════════════════════════════════ */

.sp-chat-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 4px 0 12px;
  min-height: 0;          /* critical: lets flex:1 actually shrink */
  scroll-behavior: smooth;
  animation: spZoomIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.08s both;
}

/* No max-height caps needed anymore — the parent (#sp-chat) is
   the fixed-height container; chat body fills what's left after
   the header and input bar take their natural height. */


.sp-chat-body::-webkit-scrollbar { width: 5px; }
.sp-chat-body::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 99px; }

.sp-chat-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 30px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.sp-chat-empty {
  text-align: center;
  padding: 30px;
  color: var(--muted);
  font-size: 12px;
}

/* Message rows */
.sp-msg-row {
  display: flex;
  gap: 8px;
}
.sp-msg-user { justify-content: flex-end; }
.sp-msg-bot  { justify-content: flex-start; align-items: flex-end; }

.sp-msg-group { display: flex; flex-direction: column; gap: 3px; max-width: 76%; }
.sp-msg-group-user { align-items: flex-end; }

.sp-msg-top {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 2px;
}
.sp-msg-name { font-size: 10px; font-weight: 700; color: var(--muted); }
.sp-msg-top span:last-child { font-size: 9.5px; color: var(--muted); }

.sp-msg-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.sp-msg-bot-bubble {
  background: #ffffff;
  border: 1.5px solid var(--card-border);
  color: var(--ink);
  border-bottom-left-radius: 5px;
}

.sp-msg-user-bubble {
  background: var(--blue);
  color: #ffffff;
  border-bottom-right-radius: 5px;
}

.sp-msg-text {
  white-space: pre-wrap;
}

/* Image attachments — drop the bubble padding/background so the
   photo reads as a photo, not a tinted card. */
.sp-msg-bubble-img {
  padding: 4px;
  background: transparent !important;
  border-color: transparent;
}
.sp-msg-img {
  display: block;
  width: 100%;
  max-width: 220px;
  border-radius: 14px;
  cursor: pointer;
}
.sp-msg-img-caption {
  margin-top: 6px;
  padding: 0 6px 4px;
}

.sp-msg-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  font-size: 9.5px;
  color: var(--muted);
  padding: 0 2px;
}
.sp-msg-meta svg { color: var(--blue-soft-text); }

.sp-msg-meta-bot { justify-content: flex-start; }

/* System / status messages */
.sp-msg-system {
  display: flex;
  justify-content: center;
  padding: 4px 0;
}
.sp-msg-system-inner {
  background: var(--blue-soft);
  color: var(--blue-soft-text);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.55;
  padding: 12px 16px;
  max-width: 90%;
  text-align: center;
}

/* Closed divider */
.sp-closed-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--green-soft-text);
  background: var(--green-soft);
  border-radius: 99px;
  padding: 7px 16px;
  align-self: center;
  margin-top: 6px;
}

/* Closed notice bar */
.sp-chat-closed-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--green-soft) 80%, transparent);
  border: 1px solid rgba(22, 163, 74, 0.18);
  backdrop-filter: blur(10px) saturate(150%);
  -webkit-backdrop-filter: blur(10px) saturate(150%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.5);
  border-radius: 14px;
  margin-top: 12px;
  flex-shrink: 0;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--green-soft-text);
  animation: spZoomIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.sp-chat-closed-bar span { flex: 1; }
.sp-chat-closed-bar .sp-hero-cta {
  background: var(--green-soft-text);
  color: #ffffff;
  height: 32px;
  padding: 0 14px;
  font-size: 11px;
}
.sp-chat-closed-bar .sp-hero-cta:hover { background: #16a34a; }

/* Input bar */
.sp-chat-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.82) 0%, rgba(255,255,255,0.6) 100%);
  border: 1px solid rgba(255,255,255,0.65);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-radius: 16px;
  padding: 8px 8px 8px 14px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.85),
    0 4px 14px rgba(20,30,70,.06);
  animation: spZoomIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both;
}

.sp-chat-input-wrap { flex: 1; }

.sp-chat-input-wrap input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: 13.5px;
  font-family: var(--font-main);
  color: var(--ink);
  line-height: 1.4;
  padding: 4px 0;
}
.sp-chat-input-wrap input::placeholder { color: #aab3c2; }

.sp-attach-btn {
  width: 38px; height: 38px;
  min-width: 38px;
  border-radius: 11px;
  border: none;
  background: rgba(241,245,249,0.7);
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease,
              transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
}
.sp-attach-btn:hover  { background: rgba(226,232,240,0.85); color: var(--ink); transform: translateY(-1px); }
.sp-attach-btn:active { transform: scale(0.94); }
.sp-attach-btn svg     { width: 18px; height: 18px; }

.sp-send-btn {
  width: 38px; height: 38px;
  min-width: 38px;
  border-radius: 11px;
  border: none;
  background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease;
  flex-shrink: 0;
}
.sp-send-btn:hover  { background: #1d4ed8; }
.sp-send-btn:active { transform: scale(0.94); }
.sp-send-btn svg    { width: 18px; height: 18px; }

/* ════════════════════════════════════════════════════════════
   PRIVACY / TERMS SCREENS
   ════════════════════════════════════════════════════════════ */

.sp-scroll-body {
  overflow-y: auto;
  padding-bottom: 20px;
}

/* Policy hero banner */
.sp-policy-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 16px;
  padding: 16px 18px;
  margin-bottom: 20px;
  font-size: 13.5px;
  font-weight: 700;
  border: 1px solid rgba(255,255,255,0.4);
  backdrop-filter: blur(10px) saturate(150%);
  -webkit-backdrop-filter: blur(10px) saturate(150%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.5);
  animation: spZoomIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.06s both;
}
.sp-policy-hero p { margin: 0; }
.sp-policy-hero svg { flex-shrink: 0; }

.sp-ph-purple {
  background: color-mix(in srgb, var(--purple-soft) 80%, transparent);
  color: var(--purple-soft-text);
}
.sp-ph-blue {
  background: color-mix(in srgb, var(--blue-soft) 80%, transparent);
  color: var(--blue-soft-text);
}

/* Policy content typography */
.sp-policy-content {
  font-size: 13px;
  line-height: 1.65;
  color: #3b4458;
}

.sp-policy-content p {
  margin: 0 0 12px;
}

.sp-policy-content h3,
.policy-section-head {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  margin: 20px 0 6px;
  letter-spacing: -0.1px;
}

.sp-policy-content ul {
  margin: 0 0 12px;
  padding-left: 18px;
}

.sp-policy-content li {
  margin-bottom: 5px;
}

/* CTA card at bottom of policy screens */
.sp-policy-cta-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.78) 0%, rgba(255,255,255,0.55) 100%);
  border: 1px solid rgba(255,255,255,0.6);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.85),
    inset 0 -1px 1px rgba(20,30,70,0.03),
    0 4px 16px rgba(20,30,70,0.05);
  border-radius: 16px;
  padding: 18px;
  margin-top: 24px;
  animation: spZoomIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.sp-policy-cta-card .sp-row-title {
  font-size: 14px;
  font-weight: 800;
  margin: 0 0 4px;
  white-space: normal;
}
.sp-policy-cta-card .sp-row-sub {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  white-space: normal;
}
.sp-policy-cta-card .sp-hero-cta {
  background: var(--blue);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 22px;
  margin-top: 12px;
}
.sp-policy-cta-card .sp-hero-cta:hover { background: #1d4ed8; }
/* ════════════════════════════════════════════════════════════
   DESKTOP LAYOUT  ≥ 1024px
   ════════════════════════════════════════════════════════════ */
@media (min-width: 1024px) {

  /* Hub: Quick Help + Legal cards sit side by side */
  #sp-hub .sp-hub-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
  }

  /* Hero banner spans the full width above the grid */
  #sp-hub .sp-hero-banner { grid-column: 1 / -1; }

  /* Chat card — exact header height is 62px on desktop.
     Page padding: 32px top + 80px bottom = 112px.
     Total offset: 62 + 112 = 174px.
     The card is a flex column; chat body fills remaining space
     and scrolls internally; input bar stays pinned at bottom.  */
  /* Card styling applies always so the box appears instantly
     when .is-active is added — but display:flex only when active
     so the card is hidden on hub/privacy/terms screens.         */
  #sp-chat {
    height: calc(100dvh - 62px - 112px);
    max-height: 820px;
    min-height: 460px;
    border: 1.5px solid var(--card-border);
    border-radius: 20px;
    padding: 20px 24px 0;
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(20,30,70,.05);
    overflow: hidden;
    /* NOTE: display is controlled by .sp-screen / .sp-screen.is-active
       — do NOT set display:flex here or it overrides the hide rule.  */
  }

  /* Only when active: switch to flex column so internal layout works */
  #sp-chat.is-active {
    display: flex;
    flex-direction: column;
  }

  /* Sub-header never scrolls */
  #sp-chat .sp-sub-header {
    flex-shrink: 0;
  }

  /* Message list fills the middle */
  #sp-chat .sp-chat-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }

  /* Closed bar never scrolls */
  #sp-chat .sp-chat-closed-bar {
    flex-shrink: 0;
  }

  /* Input bar pinned at bottom inside the card */
  #sp-chat .sp-chat-input-bar {
    flex-shrink: 0;
    margin: 12px 0 16px;
  }


}

