body.ghost-chat-open {
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
}

body.ghost-chat-open nav.bottom-nav {
  display: none !important;
}

.ghost-chat-shell {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  background: rgba(9, 14, 26, 0.12);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 80px 24px 24px;
  box-sizing: border-box;
}

.ghost-chat-shell--sheet {
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: rgba(9, 14, 26, 0.48);
}

.ghost-chat-shell {
  overscroll-behavior: contain;
  touch-action: none;
}

.ghost-chat-shell[hidden] {
  display: none !important;
}

.ghost-chat-shell--inline {
  position: relative;
  inset: auto;
  background: linear-gradient(145deg, #0f172a 0%, #111827 24%, #0b1020 100%);
  border-radius: 20px;
  padding: 1px;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.35);
}

.ghost-chat-panel {
  width: min(560px, calc(100vw - 32px));
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.18), transparent 30%),
    linear-gradient(180deg, #0b1220 0%, #0f172a 100%);
  border-radius: 28px;
  border: 1px solid rgba(99, 102, 241, 0.22);
  box-shadow: 0 28px 80px rgba(2, 6, 23, 0.52);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
  color: #e5eefb;
}

.ghost-chat-panel--floating {
  position: absolute;
  right: 24px;
  top: 24px;
  bottom: auto;
  width: min(560px, calc(100vw - 48px));
  max-height: min(calc(100vh - 120px), 820px);
}

.ghost-sheet-handle {
  display: none;
  width: 64px;
  height: 7px;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.55);
  margin: 12px auto 8px;
  touch-action: none;
  position: relative;
  flex: 0 0 auto;
}

.ghost-sheet-handle::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 112px;
  height: 34px;
  transform: translate(-50%, -50%);
}

.ghost-chat-panel--sheet .ghost-sheet-handle {
  display: block;
  margin-top: 4px;
}

.ghost-chat-panel--sheet {
  width: 100%;
  max-width: 720px;
  max-height: 88vh;
  border-radius: 24px 24px 0 0;
  animation: ghost-sheet-in 220ms ease;
  touch-action: none;
  padding-top: 10px;
}

.ghost-chat-panel--inline {
  width: 100%;
  max-height: none;
  border-radius: 18px;
  background: #0b1224;
  color: #e5e7eb;
}

.ghost-chat-shell--sheet .ghost-chat-panel {
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.38);
}

@keyframes ghost-sheet-in {
  from {
    transform: translateY(12%);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.ghost-chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.18), rgba(15, 23, 42, 0));
  flex-wrap: nowrap;
}

.ghost-chat-header--draggable {
  cursor: grab;
  user-select: none;
}

.ghost-chat-header--dragging {
  cursor: grabbing;
}

.ghost-chat-poke-slot {
  flex-shrink: 0;
  margin-left: auto;
}

.ghost-chat-close {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  color: #f8fafc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.16s ease, transform 0.16s ease;
  display: none;
}

.ghost-chat-close:hover {
  background: rgba(148, 163, 184, 0.18);
  transform: translateY(-1px);
}

.ghost-chat-close .material-icons {
  font-size: 20px;
}

.ghost-chat-poke-slot:empty {
  display: none !important;
}

.ghost-chat-panel--inline .ghost-chat-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #e5e7eb;
}

.ghost-chat-entity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.ghost-chat-avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.25), rgba(14, 165, 233, 0.18));
  flex-shrink: 0;
  border: 1px solid rgba(129, 140, 248, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.ghost-chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ghost-chat-panel--inline .ghost-chat-avatar {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
}

.ghost-chat-title {
  font-weight: 900;
  font-size: 17px;
  line-height: 1.15;
  color: #f8fafc;
  grid-area: title;
  min-width: 0;
  align-self: end;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ghost-chat-subtitle {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  line-height: 1.2;
  color: #94a3b8;
  grid-area: subtitle;
  min-width: 0;
  align-self: start;
}

.ghost-chat-panel--inline .ghost-chat-title {
  color: #f9fafb;
}

.ghost-chat-panel--inline .ghost-chat-subtitle {
  color: #cbd5f5;
}

.ghost-chat-title-wrap {
  min-width: 0;
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "title brand"
    "subtitle brand";
  gap: 2px 10px;
  align-items: center;
}

.ghost-chat-title-wrap--no-brand {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "title"
    "subtitle";
}

.ghost-chat-brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(96, 165, 250, 0.18);
  color: #f8fafc;
  grid-area: brand;
  justify-self: end;
  align-self: start;
}

.ghost-chat-brand--hidden {
  display: none !important;
}

.ghost-chat-brand img {
  width: 18px;
  height: 18px;
  display: block;
}

.ghost-chat-brand strong {
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.ghost-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 18px 12px;
}

.ghost-chat-suggestion {
  appearance: none;
  border: 1px solid rgba(129, 140, 248, 0.24);
  background: rgba(30, 41, 59, 0.78);
  color: #e2e8f0;
  border-radius: 999px;
  padding: 9px 12px;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.ghost-chat-suggestion:hover {
  transform: translateY(-1px);
  border-color: rgba(96, 165, 250, 0.4);
  background: rgba(37, 99, 235, 0.16);
}

.ghost-offers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 18px 8px;
}

.ghost-chip {
  border: 1px solid rgba(129, 140, 248, 0.28);
  background: rgba(129, 140, 248, 0.10);
  color: #e2e8f0;
  padding: 9px 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-weight: 800;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.ghost-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(96, 165, 250, 0.4);
  background: rgba(96, 165, 250, 0.14);
}

.ghost-chat-panel--inline .ghost-chip {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: #e0e7ff;
}

.ghost-chip .material-icons {
  font-size: 16px;
}

.ghost-chip--inactive-cta {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.4);
  color: #1d4ed8;
  min-height: 52px;
  padding: 8px 12px;
}

.ghost-chip--owner-cta {
  gap: 8px;
}

.ghost-chip--stacked {
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 128px;
  border-radius: 16px;
}

.ghost-chip__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.ghost-chip__icon--candao img {
  width: 18px;
  height: 18px;
  display: block;
}

.ghost-chip__text {
  display: inline-flex;
  align-items: center;
  font-weight: 800;
  line-height: 1.1;
}

.ghost-chip__text--stacked {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  line-height: 1;
  white-space: nowrap;
}

.ghost-chat-log {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 10px 18px 14px;
  background: transparent;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ghost-chat-panel--inline .ghost-chat-log {
  background: radial-gradient(circle at 20% 20%, rgba(79, 70, 229, 0.09), transparent 40%), #0b1224;
}

.ghost-intent-form {
  display: none;
}

.ghost-chat-panel--inline .ghost-intent-form input {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.12);
  color: #f9fafb;
}

.ghost-msg {
  max-width: 88%;
  padding: 12px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.45;
}

.ghost-msg.bot {
  background: rgba(15, 23, 42, 0.72);
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.12);
  align-self: flex-start;
}

.ghost-chat-panel--inline .ghost-msg.bot {
  background: rgba(255, 255, 255, 0.06);
  color: #e5e7eb;
  border-color: rgba(255, 255, 255, 0.08);
}

.ghost-msg.me {
  background: linear-gradient(135deg, #4f46e5, #2563eb);
  color: #fff;
  align-self: flex-end;
  box-shadow: 0 16px 28px rgba(37, 99, 235, 0.24);
}

.ghost-chat-input {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  padding: 14px 18px 18px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  width: 100%;
  box-sizing: border-box;
  background: rgba(8, 12, 28, 0.72);
}

.ghost-chat-input input {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid rgba(129, 140, 248, 0.18);
  border-radius: 18px;
  padding: 0 14px;
  font-size: 16px;
  height: 52px;
  background: rgba(15, 23, 42, 0.88);
  color: #f8fafc;
}

.ghost-chat-panel--inline .ghost-chat-input input {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
  color: #e5e7eb;
}

.ghost-chat-input button {
  border: none;
  background: linear-gradient(135deg, #38bdf8, #4f46e5);
  color: #fff;
  padding: 10px 18px;
  border-radius: 18px;
  cursor: pointer;
  font-weight: 800;
  white-space: nowrap;
  min-width: 104px;
  box-shadow: 0 16px 28px rgba(59, 130, 246, 0.24);
}

.ghost-chat-panel--inline .ghost-chat-input button {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.ghost-chat-inline-host {
  position: relative;
}

.ghost-launch-btn {
  border: none;
  background: #10b981;
  color: #fff;
  padding: 10px 12px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(16, 185, 129, 0.18);
}

.ghost-launch-btn .material-icons {
  font-size: 18px;
}

.ghost-action-tray {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ghost-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  color: #fff;
  font-size: 16px;
  box-shadow: 0 8px 18px rgba(99, 102, 241, 0.25);
}

@media (min-height: 900px) {
  .ghost-chat-panel--inline {
    min-height: 560px;
  }
}

@media (max-width: 640px) {
  .ghost-chat-panel {
    width: 100%;
    height: 100%;
    border-radius: 0;
  }

  .ghost-chat-panel--floating {
    position: relative;
    right: auto;
    bottom: auto;
    width: 100%;
    max-height: 90vh;
  }

  .ghost-chat-shell {
    padding: 0;
  }

  .ghost-chat-header--draggable {
    cursor: default;
  }

  .ghost-chat-brand {
    padding: 7px 10px;
  }

  .ghost-chat-title-wrap:not(.ghost-chat-title-wrap--no-brand) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "title"
      "subtitle"
      "brand";
    gap: 6px;
    align-items: start;
  }

  .ghost-chat-title-wrap:not(.ghost-chat-title-wrap--no-brand) .ghost-chat-brand {
    justify-self: start;
    align-self: center;
    max-width: 100%;
    margin-top: 1px;
  }

  .ghost-chat-suggestions {
    padding-left: 14px;
    padding-right: 14px;
  }
}

/* ==============================================
   Graph Popup Ghost Chat Overrides
   Make inline chat fill available space in popups
   ============================================== */
.graph-popup .ghost-chat-shell--inline,
.graph-popup .ghost-inline-slot .ghost-chat-shell--inline {
  position: relative;
  inset: auto;
  background: transparent;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  min-height: 280px;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.graph-popup .ghost-chat-panel--inline {
  flex: 1 1 auto;
  min-height: clamp(320px, 52vh, 620px);
  height: 100%;
  max-height: none;
  border-radius: 14px;
  background: linear-gradient(145deg, #0f172a 0%, #1e1b4b 100%);
}

.graph-popup .ghost-chat-log {
  flex: 1 1 auto;
  min-height: 180px;
  max-height: none;
  overflow-y: auto;
}

.graph-popup .ghost-chat-input {
  flex-shrink: 0;
  padding: 12px 14px;
}

/* Make ghost inline slot in popup expand */
.graph-popup .ghost-inline-slot,
.graph-popup [data-ghost-inline-slot] {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 200px;
}

/* Ghost section in popup should expand */
.graph-popup .popup-section--ghost,
.graph-popup .popup-section.popup-section--ghost {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ==============================================
   Popup-Context Ghost Chat Overrides
   Clean, light-themed chat for map popups
   ============================================== */

/* Container reset for popup context */
.popup-tab-panel[data-tab-panel="ai"] .ghost-chat-shell--inline,
.popup-section--ghost .ghost-chat-shell--inline,
.fancy-popup-card .ghost-chat-shell--inline,
.asset-popup-card .ghost-chat-shell--inline {
  position: relative;
  inset: auto;
  background: transparent;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  overflow-x: hidden !important;
  min-height: auto;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

/* Light-themed panel for popup context */
.popup-tab-panel[data-tab-panel="ai"] .ghost-chat-panel--inline,
.popup-section--ghost .ghost-chat-panel--inline,
.fancy-popup-card .ghost-chat-panel--inline,
.asset-popup-card .ghost-chat-panel--inline {
  background: linear-gradient(160deg, #ffffff 0%, #f8fafc 100%);
  color: #1e293b;
  border: 1px solid rgba(99, 102, 241, 0.12);
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.06);
  max-height: none;
  overflow: hidden;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: clamp(340px, 58vh, 680px);
  height: 100%;
}

/* Header styling for popup */
.popup-tab-panel[data-tab-panel="ai"] .ghost-chat-header,
.popup-section--ghost .ghost-chat-header,
.fancy-popup-card .ghost-chat-panel--inline .ghost-chat-header {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.06), rgba(255, 255, 255, 0.9));
  border-bottom: 1px solid rgba(99, 102, 241, 0.08);
  padding: 12px 14px 10px;
  align-items: flex-start;
  flex-wrap: nowrap;
  gap: 10px;
}

.popup-tab-panel[data-tab-panel="ai"] .ghost-chat-title,
.popup-section--ghost .ghost-chat-title,
.fancy-popup-card .ghost-chat-panel--inline .ghost-chat-title {
  color: #1e293b;
  font-size: 15px;
  grid-area: title;
  align-self: end;
  line-height: 1.22;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.popup-tab-panel[data-tab-panel="ai"] .ghost-chat-subtitle,
.popup-section--ghost .ghost-chat-subtitle,
.fancy-popup-card .ghost-chat-panel--inline .ghost-chat-subtitle {
  color: #64748b;
  grid-area: subtitle;
  align-self: start;
}

.popup-tab-panel[data-tab-panel="ai"] .ghost-chat-avatar,
.popup-section--ghost .ghost-chat-avatar,
.fancy-popup-card .ghost-chat-panel--inline .ghost-chat-avatar {
  background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
  border: 2px solid rgba(99, 102, 241, 0.2);
  width: 44px;
  height: 44px;
  border-radius: 14px;
}

.popup-tab-panel[data-tab-panel="ai"] .ghost-chat-entity,
.popup-section--ghost .ghost-chat-entity,
.fancy-popup-card .ghost-chat-panel--inline .ghost-chat-entity {
  flex: 1 1 auto;
  min-width: 0;
  gap: 12px;
}

.popup-tab-panel[data-tab-panel="ai"] .ghost-chat-title-wrap,
.popup-section--ghost .ghost-chat-title-wrap,
.fancy-popup-card .ghost-chat-panel--inline .ghost-chat-title-wrap {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "title brand"
    "subtitle brand";
  gap: 2px 10px;
  align-items: center;
}

.popup-tab-panel[data-tab-panel="ai"] .ghost-chat-brand,
.popup-section--ghost .ghost-chat-brand,
.fancy-popup-card .ghost-chat-panel--inline .ghost-chat-brand {
  grid-area: brand;
  align-self: start;
  justify-self: end;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  margin-left: 0;
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.14);
  color: #4338ca;
}

.popup-tab-panel[data-tab-panel="ai"] .ghost-chat-brand--hidden,
.popup-section--ghost .ghost-chat-brand--hidden,
.fancy-popup-card .ghost-chat-panel--inline .ghost-chat-brand--hidden {
  display: none !important;
}

.popup-tab-panel[data-tab-panel="ai"] .ghost-chat-brand img,
.popup-section--ghost .ghost-chat-brand img,
.fancy-popup-card .ghost-chat-panel--inline .ghost-chat-brand img {
  width: 16px;
  height: 16px;
}

.popup-tab-panel[data-tab-panel="ai"] .ghost-chat-brand strong,
.popup-section--ghost .ghost-chat-brand strong,
.fancy-popup-card .ghost-chat-panel--inline .ghost-chat-brand strong {
  font-size: 0.8rem;
}

.popup-tab-panel[data-tab-panel="ai"] .ghost-chat-title-wrap--no-brand,
.popup-section--ghost .ghost-chat-title-wrap--no-brand,
.fancy-popup-card .ghost-chat-panel--inline .ghost-chat-title-wrap--no-brand {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "title"
    "subtitle";
}

@media (max-width: 560px) {
  .popup-tab-panel[data-tab-panel="ai"] .ghost-chat-title-wrap,
  .popup-section--ghost .ghost-chat-title-wrap,
  .fancy-popup-card .ghost-chat-panel--inline .ghost-chat-title-wrap {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "title"
      "subtitle"
      "brand";
    gap: 6px;
    align-items: start;
  }

  .popup-tab-panel[data-tab-panel="ai"] .ghost-chat-brand,
  .popup-section--ghost .ghost-chat-brand,
  .fancy-popup-card .ghost-chat-panel--inline .ghost-chat-brand {
    justify-self: start;
    align-self: center;
    margin-top: 1px;
    max-width: 100%;
  }
}

.popup-tab-panel[data-tab-panel="ai"] .ghost-chat-close,
.popup-section--ghost .ghost-chat-close,
.fancy-popup-card .ghost-chat-panel--inline .ghost-chat-close {
  display: none;
}

/* Chat log area - clean white with subtle scroll */
.popup-tab-panel[data-tab-panel="ai"] .ghost-chat-log,
.popup-section--ghost .ghost-chat-log,
.fancy-popup-card .ghost-chat-panel--inline .ghost-chat-log {
  background: #ffffff;
  border-radius: 12px;
  margin: 8px 12px;
  padding: 12px;
  max-height: none;
  min-height: 220px;
  flex: 1 1 auto;
  overflow-x: hidden !important;
  overflow-y: auto;
  border: 1px solid rgba(148, 163, 184, 0.12);
}

/* Custom scroll for chat log */
.popup-tab-panel[data-tab-panel="ai"] .ghost-chat-log::-webkit-scrollbar,
.popup-section--ghost .ghost-chat-log::-webkit-scrollbar {
  width: 4px;
}

.popup-tab-panel[data-tab-panel="ai"] .ghost-chat-log::-webkit-scrollbar-thumb,
.popup-section--ghost .ghost-chat-log::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.2);
  border-radius: 4px;
}

/* Bot messages - light theme */
.popup-tab-panel[data-tab-panel="ai"] .ghost-msg.bot,
.popup-section--ghost .ghost-msg.bot,
.fancy-popup-card .ghost-chat-panel--inline .ghost-msg.bot {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 14px 14px 14px 4px;
  font-size: 13px;
  line-height: 1.5;
}

.popup-tab-panel[data-tab-panel="ai"] .ghost-msg,
.popup-section--ghost .ghost-msg,
.fancy-popup-card .ghost-chat-panel--inline .ghost-msg {
  max-width: 92%;
  font-size: 14px;
  line-height: 1.55;
}

/* User messages */
.popup-tab-panel[data-tab-panel="ai"] .ghost-msg.me,
.popup-section--ghost .ghost-msg.me,
.fancy-popup-card .ghost-chat-panel--inline .ghost-msg.me {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #ffffff;
  border-radius: 14px 14px 4px 14px;
}

/* Input area - light theme */
.popup-tab-panel[data-tab-panel="ai"] .ghost-chat-input,
.popup-section--ghost .ghost-chat-input,
.fancy-popup-card .ghost-chat-panel--inline .ghost-chat-input {
  background: #f8fafc;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  padding: 12px;
  flex: 0 0 auto;
}

.popup-tab-panel[data-tab-panel="ai"] .ghost-chat-input input,
.popup-section--ghost .ghost-chat-input input,
.fancy-popup-card .ghost-chat-panel--inline .ghost-chat-input input {
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #1e293b;
  border-radius: 10px;
  font-size: 14px;
  min-height: 48px;
  padding: 0 14px;
}

.popup-tab-panel[data-tab-panel="ai"] .ghost-chat-input input::placeholder {
  color: #94a3b8;
}

.popup-tab-panel[data-tab-panel="ai"] .ghost-chat-input button,
.popup-section--ghost .ghost-chat-input button,
.fancy-popup-card .ghost-chat-panel--inline .ghost-chat-input button {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  border: none;
  color: #fff;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  padding: 0 16px;
  min-width: 88px;
  min-height: 48px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

/* Chips/offers - light theme */
.popup-tab-panel[data-tab-panel="ai"] .ghost-chip,
.popup-section--ghost .ghost-chip,
.fancy-popup-card .ghost-chat-panel--inline .ghost-chip {
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  color: #4338ca;
  font-weight: 600;
}

.popup-tab-panel[data-tab-panel="ai"] .ghost-chip--inactive-cta,
.popup-section--ghost .ghost-chip--inactive-cta,
.fancy-popup-card .ghost-chat-panel--inline .ghost-chip--inactive-cta {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(59, 130, 246, 0.14));
  border-color: rgba(59, 130, 246, 0.26);
  color: #4338ca;
}

.popup-tab-panel[data-tab-panel="ai"] .ghost-offers,
.popup-section--ghost .ghost-offers {
  padding: 8px 12px 4px;
}

/* Ghost inline info text */
.popup-tab-panel[data-tab-panel="ai"] .ghost-inline-info,
.popup-section--ghost .ghost-inline-info {
  padding: 0 12px;
  color: #475569;
}

.popup-tab-panel[data-tab-panel="ai"] .ghost-inline-info div,
.popup-section--ghost .ghost-inline-info div {
  color: #334155 !important;
}

/* ==============================================
   Multirole detail modal sizing
   Keep AI Ghost tab large enough for a real conversation
   ============================================== */
.mr-modal:has(.mr-detail-pane--ghost .ghost-chat-panel--inline) {
  max-height: min(88vh, 860px);
}

.mr-modal-body:has(.mr-detail-pane--ghost .ghost-chat-panel--inline) {
  min-height: min(78vh, 720px);
}

.mr-detail-card:has(.mr-detail-pane--ghost .ghost-chat-panel--inline) {
  min-height: min(72vh, 660px);
  max-height: none;
}

.mr-detail-panes:has(.mr-detail-pane--ghost .ghost-chat-panel--inline) {
  min-height: min(64vh, 580px);
}

.mr-detail-pane--ghost:has(.ghost-chat-panel--inline) {
  min-height: min(60vh, 540px);
}

.mr-detail-pane--ghost .mr-ghost-pane {
  min-height: 100%;
}
