/* Botlink · mobile-first chat UI — aligned with plan design system */

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg:        #0a0a0f;
  --text:      #e0e0e0;
  --dim:       #888;
  --dim-2:     #555;
  --surface:   rgba(255,255,255,0.02);
  --surface-2: rgba(0,0,0,0.25);
  --border:    rgba(255,255,255,0.08);
  --border-soft: rgba(255,255,255,0.05);

  --c-input:   #fbbf24;    /* D */
  --c-process: #a78bfa;    /* E */
  --c-output:  #34d399;    /* F */
  --c-sales:   #f43f5e;    /* G */
  --c-blue:    #60a5fa;    /* accent */

  --grad-primary: linear-gradient(135deg, #60a5fa, #34d399);
  --radius-card: 14px;
  --radius-bubble: 14px;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  line-height: 1.55;
  height: 100%;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.mono { font-family: 'SF Mono', 'Fira Code', Consolas, monospace; }
.hidden { display: none !important; }

/* ========== Header ========== */
.chat-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: rgba(10,10,15,0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex; align-items: center; gap: 8px;
}
.brand-logo {
  height: 22px; width: auto; display: block;
}
@media (max-width: 400px) {
  .brand-logo { height: 18px; }
}
.brand-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--grad-primary);
  flex-shrink: 0;
}
.brand-name { letter-spacing: 0.5px; }

.stage-pill {
  flex: 1;
  display: flex; justify-content: center;
  font-size: 0.78em;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.stage-pill .stage-label {
  padding: 4px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(255,255,255,0.03);
  color: var(--dim);
}
.stage-pill[data-stage="D"] .stage-label { color: var(--c-input);   background: rgba(251,191,36,0.1);  border-color: rgba(251,191,36,0.3); }
.stage-pill[data-stage="E"] .stage-label { color: var(--c-process); background: rgba(167,139,250,0.1); border-color: rgba(167,139,250,0.3); }
.stage-pill[data-stage="F"] .stage-label { color: var(--c-output);  background: rgba(52,211,153,0.1);  border-color: rgba(52,211,153,0.3); }
.stage-pill[data-stage="G"] .stage-label { color: var(--c-sales);   background: rgba(244,63,94,0.1);   border-color: rgba(244,63,94,0.3); }

.icon-btn {
  background: transparent; border: 0;
  color: var(--text);
  font-size: 1.4em; padding: 4px 10px; cursor: pointer;
  border-radius: 8px;
}
.icon-btn:hover, .icon-btn:active { background: rgba(255,255,255,0.06); }

/* ========== Thread ========== */
.thread {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 12px;
  display: flex; flex-direction: column;
  gap: 12px;
}

.msg-wrap { display: flex; flex-direction: column; max-width: 86%; }
.msg-wrap.user { align-self: flex-end; align-items: flex-end; }
.msg-wrap.agent { align-self: flex-start; }
.msg-wrap.system { align-self: center; max-width: 90%; }
/* Messages that carry a business card need way more room than text bubbles —
   force them to ~98% so the card has space to breathe. Detected by checking
   for the .biz-card descendant via :has(). */
.msg-wrap:has(.biz-card) { max-width: 98%; width: 98%; align-self: stretch; }

.msg-label {
  font-size: 0.7em;
  color: var(--dim-2);
  padding: 0 6px 4px;
  letter-spacing: 0.5px;
}
.msg-wrap.agent-onb  .msg-label { color: var(--c-input); }
.msg-wrap.agent-sales .msg-label { color: var(--c-sales); }
.msg-wrap.user .msg-label { color: var(--c-blue); }

.msg {
  padding: 10px 14px;
  border-radius: var(--radius-bubble);
  font-size: 0.95em;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
}
.msg.agent-onb {
  background: rgba(251,191,36,0.09);
  border: 1px solid rgba(251,191,36,0.22);
  color: #e8d4a0;
  border-bottom-left-radius: 4px;
}
.msg.agent-sales {
  background: rgba(244,63,94,0.09);
  border: 1px solid rgba(244,63,94,0.22);
  color: #f0b7bf;
  border-bottom-left-radius: 4px;
}
.msg.user {
  background: rgba(96,165,250,0.14);
  border: 1px solid rgba(96,165,250,0.25);
  color: #c4d6f0;
  border-bottom-right-radius: 4px;
}
.msg.system {
  font-size: 0.82em;
  color: var(--dim);
  text-align: center;
  border: 1px dashed var(--border);
  padding: 6px 12px;
  background: transparent;
}

/* Message meta chips (citations / extracted / golden rule) */
.msg-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.chip {
  display: inline-flex; align-items: center;
  padding: 1px 7px; border-radius: 5px;
  font-size: 0.72em; font-weight: 600;
  font-family: 'SF Mono', monospace;
  letter-spacing: 0.3px;
}
.chip.extracted { background: rgba(52,211,153,0.15); color: var(--c-output); border: 1px solid rgba(52,211,153,0.3); }
.chip.gr        { background: rgba(244,63,94,0.15);  color: var(--c-sales);  border: 1px solid rgba(244,63,94,0.3); }
.chip.cite      { background: rgba(96,165,250,0.12); color: var(--c-blue);   border: 1px solid rgba(96,165,250,0.25); }

/* Inline attachment inside a user message */
.attach-inline {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; margin-bottom: 6px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.82em;
}
.attach-inline .ai-ico { font-size: 1.2em; }
.attach-inline .ai-name { color: #bbb; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-inline .ai-size { color: var(--dim-2); font-family: 'SF Mono', monospace; font-size: 0.85em; }

/* ========== Rich payload cards inside messages ========== */
.rich-card {
  margin-top: 6px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
}
.rich-card .rc-title {
  font-weight: 700; font-size: 0.98em;
  color: var(--text); margin-bottom: 6px;
}
.rich-card .rc-sub {
  font-size: 0.8em; color: var(--dim); margin-bottom: 10px;
}

/* Profile card (business-card style, matches product-design .mock-profile) */
.biz-card {
  position: relative;
  overflow: hidden;
  margin-top: 6px;
  padding: 16px 18px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
}
/* === Sales side-trip banner · shown at top of G when entering from F === */
.sales-side-trip-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, rgba(244,63,94,0.10), rgba(251,113,133,0.06));
  border: 1px solid rgba(244,63,94,0.25);
  border-radius: 12px;
  align-self: stretch;
}
.sstb-icon { font-size: 1.6em; opacity: 0.9; }
.sstb-body { flex: 1; min-width: 0; }
.sstb-title {
  font-weight: 700; font-size: 0.94em;
  background: linear-gradient(135deg, #f43f5e, #fb7185);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.sstb-sub { font-size: 0.78em; color: #999; margin-top: 2px; }

/* === UX-03 · sticky "back from G→F" pill === */
.sales-back-pill {
  position: fixed;
  top: 60px; left: 50%; transform: translateX(-50%);
  z-index: 30;
  padding: 8px 18px;
  background: linear-gradient(135deg, rgba(244,63,94,0.92), rgba(251,113,133,0.92));
  color: white;
  border: 0; border-radius: 999px;
  font-family: inherit; font-size: 0.84em; font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(244,63,94,0.4);
  backdrop-filter: blur(6px);
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.2s;
}
.sales-back-pill:hover { transform: translateX(-50%) translateY(-1px); box-shadow: 0 10px 22px rgba(244,63,94,0.5); }
.sales-back-pill.hidden { display: none; }
@media (max-width: 520px) { .sales-back-pill { top: 56px; font-size: 0.78em; padding: 7px 14px; } }

/* === UX-01 · F1 card · staggered section-by-section reveal === */
/* Card frame fades in first (1.2s), then each section inside .bc-content
   reveals one-by-one over ~3s · total feel is "the card draws itself"  */
.biz-card.biz-card-reveal {
  animation: biz-card-drop 1.2s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
@keyframes biz-card-drop {
  0%   { transform: scale(0.97) translateY(14px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* Section reveal is JS-driven (see revealBizCard in app.js) so we can
   scroll the thread as each section appears, keeping the typing zone
   in the bottom-third of the viewport. CSS just provides the
   transition. JS sets opacity 0 → 1 with translateY 8px → 0. */
.biz-card.biz-card-reveal .bc-content > * {
  transition: opacity 0.55s cubic-bezier(0.22, 0.61, 0.36, 1),
              transform 0.55s cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* Brand pill (the BOTLINK badge top-right) · stamp animation triggered
   from JS with .bc-pill-stamp added. */
@keyframes bc-pill-stamp {
  0%   { opacity: 0; transform: scale(0.85) rotate(-8deg); }
  60%  { opacity: 1; transform: scale(1.08) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
.biz-card .bc-brand-pill.bc-pill-stamp {
  animation: bc-pill-stamp 0.7s cubic-bezier(0.34, 1.5, 0.5, 1) forwards;
}

/* Glow pulse fires AFTER the staged reveal · adjusted delay 0.8s → 4.5s */
.biz-card.biz-card-glow-pulse {
  animation: biz-card-glow 9s ease-in-out 1 4.5s;
}
@keyframes biz-card-glow {
  0%,100% { box-shadow: 0 0 0 0 rgba(96,165,250,0), 0 4px 14px rgba(0,0,0,0.3); }
  50%     { box-shadow: 0 0 0 12px rgba(96,165,250,0.16), 0 12px 36px rgba(96,165,250,0.25); }
}
@media (prefers-reduced-motion: reduce) {
  .biz-card.biz-card-reveal,
  .biz-card.biz-card-glow-pulse { animation: none; }
}

/* === UX-02 · 试试买家视角 hero CTA · slow draw-attention pulse === */
.sales-cta-hero {
  display: block !important;
  width: 100%;
  margin: 12px 0 4px !important;
  padding: 14px 20px !important;
  background: linear-gradient(135deg, #f43f5e, #fb7185) !important;
  color: white !important;
  border: 0 !important; border-radius: 999px !important;
  font-size: 1em !important; font-weight: 800 !important;
  letter-spacing: 0.5px;
  box-shadow: 0 10px 28px rgba(244,63,94,0.35);
  cursor: pointer;
  /* 2 very slow pulses (6s each) starting 4s after render · 2× slower per user feedback */
  animation: sales-cta-pulse 6s ease-in-out 2 4s;
}
.sales-cta-hero:hover { filter: brightness(1.07); transform: translateY(-1px); transition: transform 0.25s, filter 0.2s; }
@keyframes sales-cta-pulse {
  0%,100% { transform: scale(1);    box-shadow: 0 10px 28px rgba(244,63,94,0.35); }
  50%     { transform: scale(1.018); box-shadow: 0 16px 42px rgba(244,63,94,0.50); }
}
@media (prefers-reduced-motion: reduce) {
  .sales-cta-hero { animation: none; }
}

/* === Botlink watermark — Solution D + big centered logo === */
.bc-watermark {
  position: absolute; inset: 0;
  pointer-events: none; z-index: 0;
  overflow: hidden;
  /* Layer 1 · centered Botlink logo, large + ghosted */
  background-image: url('/botlink-logo.svg');
  background-repeat: no-repeat;
  background-position: center 38%;
  background-size: 78% auto;
  opacity: 0.085;
}
.bc-watermark::before {
  /* Layer 2 · diagonal repeating wordmark for second layer of branding */
  content: "BOTLINK   BOTLINK   BOTLINK   BOTLINK   BOTLINK   BOTLINK   BOTLINK   BOTLINK   BOTLINK   BOTLINK   BOTLINK   BOTLINK   BOTLINK   BOTLINK   BOTLINK   BOTLINK   BOTLINK   BOTLINK   BOTLINK   BOTLINK";
  position: absolute;
  top: -10%; left: -50%;
  width: 200%;
  font-family: -apple-system, system-ui, sans-serif;
  font-weight: 900; letter-spacing: 8px;
  font-size: 28px;
  color: rgba(0,150,216,0.32); /* watermark ghost — tuned with parent opacity */
  white-space: pre-wrap;
  word-spacing: 30px;
  line-height: 1.6;
  transform: rotate(-22deg);
  user-select: none;
}
.bc-brand-pill {
  position: absolute; top: 12px; right: 12px;
  z-index: 2;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px 5px 6px;
  background: linear-gradient(135deg, rgba(0,150,216,0.18), rgba(96,165,250,0.12));
  border: 1px solid rgba(0,150,216,0.35);
  border-radius: 999px;
  font-size: 0.66em; font-weight: 800;
  letter-spacing: 1.5px;
  color: #60a5fa;
  text-transform: uppercase;
  backdrop-filter: blur(4px);
}
.bc-brand-pill-logo {
  height: 12px; width: auto; display: block;
}
.bc-content {
  position: relative; z-index: 1;
}
.bc-footer-stamp {
  margin-top: 16px;
  padding-top: 10px;
  border-top: 1px dashed rgba(255,255,255,0.08);
  display: flex; align-items: center; gap: 8px;
  font-size: 0.7em; color: #666;
  font-family: 'SF Mono', 'Fira Code', monospace;
}
.bc-footer-logo {
  height: 12px; width: auto; opacity: 0.55;
}
.bc-name {
  font-weight: 700; font-size: 1.2em;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 2px;
}
.bc-en { font-size: 0.76em; color: var(--dim-2); margin-bottom: 8px; }
.bc-tag-line { font-size: 0.9em; color: var(--c-process); font-style: italic; margin-bottom: 12px; }
.bc-row { display: flex; gap: 8px; margin-bottom: 3px; font-size: 0.82em; }
.bc-label { color: var(--dim-2); min-width: 60px; text-align: right; flex-shrink: 0; }
.bc-value { color: #bbb; }
.bc-industry {
  display: inline-block;
  background: rgba(96,165,250,0.12); color: var(--c-blue);
  padding: 2px 8px; border-radius: 4px; font-size: 0.92em;
}
.bc-section {
  color: var(--c-blue); font-weight: 700;
  font-size: 0.72em; letter-spacing: 1px; text-transform: uppercase;
  margin: 12px 0 5px;
}
.bc-pills { display: flex; flex-wrap: wrap; gap: 5px; }
.bc-pill {
  background: rgba(52,211,153,0.1); color: var(--c-output);
  padding: 3px 10px; border-radius: 5px; font-size: 0.8em;
}
.bc-pill.blue  { background: rgba(96,165,250,0.1);  color: var(--c-blue); }
.bc-pill.amber { background: rgba(251,191,36,0.1);  color: var(--c-input); }

.bc-product {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 6px;
}
.bc-product .pc-cat  { font-size: 0.68em; color: var(--c-sales); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 3px; }
.bc-product .pc-name { font-weight: 700; font-size: 0.92em; color: var(--text); margin-bottom: 3px; }
.bc-product .pc-desc { font-size: 0.78em; color: var(--dim); line-height: 1.5; }

.bc-actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.bc-act {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.82em; font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: #bbb;
}
.bc-act.primary {
  background: var(--grad-primary);
  color: #0a0a0f;
  border-color: transparent;
  box-shadow: 0 3px 14px rgba(52,211,153,0.25);
}

/* Citation detail block (collapsible, under a sales reply) */
.citations {
  margin-top: 8px;
  padding: 10px 12px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  font-size: 0.75em;
  color: var(--dim);
}
.citations summary {
  cursor: pointer; color: var(--c-blue);
  font-weight: 600;
  list-style: none;
}
.citations summary::-webkit-details-marker { display: none; }
.citations summary::before { content: "▸ "; margin-right: 2px; }
.citations[open] summary::before { content: "▾ "; }
.citations .cite-item {
  padding: 6px 0;
  border-bottom: 1px dashed var(--border-soft);
  line-height: 1.5;
}
.citations .cite-item:last-child { border-bottom: 0; }
.citations .score { color: var(--c-output); font-weight: 700; font-family: 'SF Mono', monospace; }
.citations .src-cp { color: var(--c-output); }
.citations .src-os { color: var(--c-input); }
.citations .cite-id { color: var(--c-blue); font-family: 'SF Mono', monospace; }

/* Completeness progress inline */
.progress-inline {
  margin-top: 8px;
  display: flex; align-items: center; gap: 8px;
  font-size: 0.78em;
}
.progress-inline .p-label { color: var(--dim); }
.progress-inline .p-val { color: var(--c-output); font-weight: 700; font-family: 'SF Mono', monospace; }
.progress-inline .p-bar {
  flex: 1; height: 5px; background: rgba(255,255,255,0.05);
  border-radius: 3px; overflow: hidden;
}
.progress-inline .p-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--c-input), var(--c-output));
  transition: width 0.6s ease;
}

/* Inline action buttons (Agent Hijack-ish) */
.inline-actions {
  margin-top: 10px;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.ia-btn {
  padding: 8px 14px;
  border-radius: 20px;
  background: rgba(96,165,250,0.1);
  border: 1px solid rgba(96,165,250,0.3);
  color: var(--c-blue);
  font-size: 0.82em; font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.ia-btn.primary {
  background: var(--grad-primary);
  color: #0a0a0f;
  border-color: transparent;
}
.ia-btn.sales {
  background: rgba(244,63,94,0.1);
  border-color: rgba(244,63,94,0.3);
  color: var(--c-sales);
}

/* Typing indicator */
.typing {
  display: inline-flex; gap: 4px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 14px;
  align-self: flex-start;
  max-width: 60px;
}
.typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--dim);
  animation: typingDot 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingDot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30%           { opacity: 1;   transform: translateY(-3px); }
}

/* === Mic recording modal (full-screen during 🎤 capture) === */
.rec-modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
}
.rec-modal.hidden { display: none; }
.rec-backdrop {
  position: absolute; inset: 0;
  background: radial-gradient(circle at center, rgba(244,63,94,0.18), rgba(0,0,0,0.85));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.rec-box {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  padding: 38px 32px 32px;
  background: linear-gradient(160deg, rgba(19,19,28,0.99), rgba(10,10,15,0.99));
  border: 1px solid rgba(244,63,94,0.4);
  border-radius: 22px;
  box-shadow: 0 30px 100px rgba(244,63,94,0.35);
  width: 88%; max-width: 380px;
  text-align: center;
}
.rec-mic-pulse {
  position: relative;
  width: 110px; height: 110px;
  display: flex; align-items: center; justify-content: center;
}
.rec-mic-icon {
  position: relative; z-index: 4;
  width: 66px; height: 66px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f43f5e, #fb7185);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  box-shadow: 0 6px 20px rgba(244,63,94,0.6);
}
.rec-mic-ring {
  position: absolute; inset: 0;
  border: 2px solid rgba(244,63,94,0.45);
  border-radius: 50%;
  animation: rec-ripple 3.2s ease-out infinite;  /* 2× slower per user feedback */
}
.rec-mic-ring-2 { animation-delay: 1.0s; }
.rec-mic-ring-3 { animation-delay: 2.0s; }
@keyframes rec-ripple {
  0%   { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}
.rec-title {
  font-size: 1.1em; font-weight: 700;
  background: linear-gradient(135deg, #f43f5e, #fb7185);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.rec-timer {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 2.6em; font-weight: 800;
  color: #fda4af;
  letter-spacing: 2px;
}
.rec-hint { font-size: 0.82em; color: #888; margin-top: -4px; }
.rec-stop-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 36px;
  background: linear-gradient(135deg, #f43f5e, #fb7185);
  color: white;
  border: 0; border-radius: 999px;
  font-family: inherit; font-size: 1em; font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(244,63,94,0.45);
  transition: transform 0.1s;
}
.rec-stop-btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.rec-stop-btn:active { transform: translateY(0); }
.rec-stop-icon { font-size: 1.1em; }
.rec-cancel {
  background: transparent; border: 0;
  color: #777; font-family: inherit; font-size: 0.85em;
  cursor: pointer; padding: 6px 12px;
}
.rec-cancel:hover { color: #aaa; }
@media (max-width: 400px) {
  .rec-timer { font-size: 2.2em; }
  .rec-stop-btn { padding: 12px 28px; }
}

/* === Z5 · Rehydrate history view === */
.rh-divider {
  text-align: center;
  font-size: 0.74em;
  color: #777;
  letter-spacing: 1px;
  padding: 12px 0;
  margin: 8px 0;
  border-top: 1px dashed rgba(255,255,255,0.08);
  border-bottom: 1px dashed rgba(255,255,255,0.08);
  background: rgba(167,139,250,0.04);
}
.rh-msg {
  opacity: 0.65;
  font-size: 0.86em;
  border-left: 3px solid rgba(167,139,250,0.2);
  padding-left: 10px;
  margin-left: 8px;
}
.rh-msg .msg-body {
  font-style: italic;
}

/* === Z4 · Register modal (login code + QR) === */
.rm-box {
  max-width: 440px;
  padding: 28px 24px 18px;
  max-height: 90vh;
  overflow-y: auto;
}
.rm-tag {
  background: rgba(245,158,11,0.18) !important;
  color: #fbbf24 !important;
}
.rm-title {
  font-size: 1.25em !important;
  margin-bottom: 6px;
}
.rm-sub {
  font-size: 0.85em !important;
  margin-bottom: 18px;
  line-height: 1.5;
}
.rm-code-block {
  background: linear-gradient(160deg, rgba(245,158,11,0.08), rgba(244,63,94,0.06));
  border: 2px solid rgba(245,158,11,0.4);
  border-radius: 14px;
  padding: 16px 14px 14px;
  text-align: center;
  margin-bottom: 14px;
}
.rm-code-label {
  font-size: 0.7em; letter-spacing: 2px;
  color: #fbbf24; font-weight: 700;
  margin-bottom: 8px;
}
.rm-code {
  font-family: 'SF Mono', monospace;
  font-size: 1.5em; font-weight: 800;
  color: #fde68a;
  letter-spacing: 3px;
  margin-bottom: 10px;
  word-break: break-all;
  text-shadow: 0 0 20px rgba(251,191,36,0.4);
}
.rm-code-actions {
  display: flex; gap: 8px; justify-content: center;
  margin-bottom: 12px;
}
.rm-act {
  padding: 8px 14px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.05);
  color: #ddd;
  border-radius: 8px;
  font-size: 0.86em;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: all 0.15s;
}
.rm-act:hover { background: rgba(255,255,255,0.1); }
.rm-act.primary {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: #0a0a0f;
  border-color: transparent;
}
.rm-act.primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(245,158,11,0.4); }
.rm-act.copied { background: rgba(52,211,153,0.18); border-color: #34d399; color: #34d399; }
.rm-act.shotted { background: rgba(167,139,250,0.18); border-color: #a78bfa; color: #a78bfa; }

.rm-qr {
  display: flex; align-items: center; justify-content: center;
  background: white;
  width: 160px; height: 160px;
  margin: 0 auto 8px;
  border-radius: 10px;
  padding: 6px;
}
.rm-qr img { width: 100%; height: 100%; image-rendering: pixelated; }
.rm-qr-spinner {
  font-size: 2em; opacity: 0.4;
}
.rm-qr-hint {
  font-size: 0.74em; color: #888;
}

.rm-optional {
  margin-bottom: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 0 14px;
}
.rm-optional summary {
  cursor: pointer;
  padding: 12px 0;
  font-size: 0.86em;
  color: #aaa;
  font-weight: 600;
  list-style: none;
}
.rm-optional summary::-webkit-details-marker { display: none; }
.rm-optional summary::before { content: '▶'; margin-right: 6px; font-size: 0.7em; transition: transform 0.2s; display: inline-block; }
.rm-optional[open] summary::before { transform: rotate(90deg); }
.rm-opt-body {
  padding: 4px 0 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.rm-input {
  padding: 10px 12px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: #e0e0e0;
  font-family: inherit;
  font-size: 0.92em;
}
.rm-input:focus {
  outline: 0;
  border-color: rgba(167,139,250,0.6);
  background: rgba(0,0,0,0.6);
}
.rm-opt-hint {
  font-size: 0.76em;
  color: #777;
  line-height: 1.4;
}

.rm-status {
  font-size: 0.82em;
  text-align: center;
  min-height: 18px;
  margin-bottom: 10px;
  color: #888;
}
.rm-status.error { color: #fb7185; }
.rm-status.ok    { color: #34d399; }
.rm-status.loading { color: #c4b5fd; }

/* === Z1 demo · skip-demo button (countdown · blink · top-right fixed) === */
.demo-skip-btn {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 9050;          /* above watermark (4500), below modals (10000+) */
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 10px 12px;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #0a0a0f;
  border: 0;
  border-radius: 14px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.86em;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.55);
  animation: dsbPulse 1.4s ease-in-out infinite;
  transition: transform 0.12s, box-shadow 0.18s;
  text-align: left;
  line-height: 1.2;
}
.demo-skip-btn.hidden { display: none; }
.demo-skip-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 32px rgba(245, 158, 11, 0.85);
}
.demo-skip-btn:active { transform: scale(0.98); }
.demo-skip-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  animation: none;
}
.dsb-icon {
  font-size: 1.5em;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.dsb-main {
  display: flex;
  flex-direction: column;
}
.dsb-text {
  font-size: 0.98em;
  font-weight: 800;
  letter-spacing: 0.5px;
}
.dsb-sub {
  font-size: 0.7em;
  font-weight: 600;
  opacity: 0.78;
}
.dsb-countdown {
  font-variant-numeric: tabular-nums;
  background: rgba(0, 0, 0, 0.22);
  color: #fde68a;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.84em;
  font-weight: 800;
  min-width: 36px;
  text-align: center;
}
@keyframes dsbPulse {
  0%, 100% {
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.55);
    filter: brightness(1);
  }
  50% {
    box-shadow: 0 10px 36px rgba(245, 158, 11, 1);
    filter: brightness(1.12);
  }
}
@media (max-width: 520px) {
  .demo-skip-btn {
    top: 12px;
    right: 12px;
    padding: 8px 10px;
  }
  .dsb-sub { display: none; }
}

/* === Z1 demo · animated diagonal "演示 · DEMO" watermark === */
.demo-watermark {
  position: fixed;
  inset: -25vh -25vw;        /* oversize so the rotation doesn't show edges */
  z-index: 4500;             /* above content (sales pill 60, modals 200,
                                Z2 transition 5000) but BELOW Z2 transition,
                                feedback portal (9999), and any modal */
  pointer-events: none;      /* clicks pass through */
  transform: rotate(-22deg); /* diagonal */
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  opacity: 0;
  animation: dwmFadeIn 0.7s ease-out 0.2s forwards;
}
.demo-watermark.hidden { display: none; }
@keyframes dwmFadeIn { from { opacity: 0; } to { opacity: 1; } }
.dwm-row {
  font-family: ui-sans-serif, -apple-system, "PingFang SC", sans-serif;
  font-size: clamp(28px, 4vw, 56px);
  font-weight: 900;
  letter-spacing: 0.18em;
  white-space: nowrap;
  color: rgba(167, 139, 250, 0.07);   /* purple ≈ SEED color · ~7% alpha */
  text-shadow: 0 0 1px rgba(167, 139, 250, 0.04);
  animation: dwmDrift 28s linear infinite;
  will-change: transform;
}
/* Stagger the rows by negative animation-delay so they're not in lockstep */
.dwm-row:nth-child(2) { animation-duration: 32s; animation-delay: -6s; }
.dwm-row:nth-child(3) { animation-duration: 24s; animation-delay: -12s; }
.dwm-row:nth-child(4) { animation-duration: 30s; animation-delay: -3s; }
.dwm-row:nth-child(5) { animation-duration: 26s; animation-delay: -9s; }
.dwm-row:nth-child(6) { animation-duration: 34s; animation-delay: -15s; }
.dwm-row:nth-child(7) { animation-duration: 22s; animation-delay: -7s; }
.dwm-row:nth-child(8) { animation-duration: 30s; animation-delay: -2s; }
@keyframes dwmDrift {
  from { transform: translateX(-15%); }
  to   { transform: translateX(15%); }
}

/* === Z2 · Transition overlay (clear+fade+greet) === */
.zt-overlay {
  position: fixed; inset: 0; z-index: 5000;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at center, rgba(15,15,30,0.96), rgba(5,5,10,0.99));
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  animation: ztFadeIn 0.35s ease-out;
}
.zt-overlay.hidden { display: none; }
.zt-overlay.fading-out { animation: ztFadeOut 0.45s ease-in forwards; }
@keyframes ztFadeIn  { from { opacity:0; } to { opacity:1; } }
@keyframes ztFadeOut { from { opacity:1; } to { opacity:0; } }

.zt-content {
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: 32px 24px;
  animation: ztRise 0.5s cubic-bezier(.2,.8,.3,1);
}
@keyframes ztRise {
  from { opacity:0; transform: translateY(16px) scale(0.96); }
  to   { opacity:1; transform: translateY(0) scale(1); }
}
.zt-icon {
  font-size: 4em; line-height: 1;
  animation: ztBob 2.2s ease-in-out infinite;
  filter: drop-shadow(0 0 30px rgba(96,165,250,0.6));
}
@keyframes ztBob {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50%      { transform: translateY(-8px) rotate(3deg); }
}
.zt-title {
  font-size: 1.45em; font-weight: 800; line-height: 1.3;
  background: linear-gradient(135deg, #60a5fa, #34d399);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.zt-sub {
  color: #aaa; font-size: 0.9em; max-width: 360px;
}
.zt-spinner {
  width: 32px; height: 32px;
  border: 3px solid rgba(167,139,250,0.2);
  border-top-color: #a78bfa;
  border-radius: 50%;
  animation: ztSpin 0.9s linear infinite;
  margin-top: 8px;
}
@keyframes ztSpin { to { transform: rotate(360deg); } }

/* === F3 · Feedback portal (only when /?fb=1) === */
/* Top-bar version (always visible · red · aligned with logo column) */
.fb-topbar {
  position: sticky;
  top: 0;
  z-index: 9998;  /* below the logo bar but above all content */
  background: linear-gradient(180deg, rgba(244,63,94,0.16), rgba(244,63,94,0.06));
  border-bottom: 1px solid rgba(244,63,94,0.35);
  padding: 6px 14px;
  display: flex; align-items: center;
}
.fb-topbar.hidden { display: none; }
.fb-topbar-btn {
  background: linear-gradient(135deg, #f43f5e, #fb7185);
  color: white;
  border: 0;
  border-radius: 8px;
  padding: 6px 14px;
  font-family: inherit;
  font-size: 0.84em;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(244,63,94,0.4);
  transition: transform 0.12s, box-shadow 0.15s;
  letter-spacing: 0.5px;
}
.fb-topbar-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(244,63,94,0.55);
}
.fb-topbar-btn:active { transform: scale(0.97); }
@media (max-width: 520px) {
  .fb-topbar-text { display: none; }
  .fb-topbar-btn { padding: 6px 10px; font-size: 0.95em; }
}

.fb-fab {
  position: fixed; bottom: 80px; right: 16px; z-index: 9999;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #f43f5e, #fb7185);
  color: white;
  border: 0; border-radius: 999px;
  font-family: inherit; font-size: 0.86em; font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(244,63,94,0.45);
  transition: transform 0.15s, box-shadow 0.2s;
}
.fb-fab:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(244,63,94,0.55); }
.fb-fab.hidden { display: none; }
@media (max-width: 520px) {
  .fb-fab-text { display: none; }
  .fb-fab { padding: 12px 14px; font-size: 1.1em; }
}

.fb-modal {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.fb-modal.hidden { display: none; }
.fb-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.fb-box {
  position: relative;
  width: 100%; max-width: 540px; max-height: 92vh; overflow-y: auto;
  background: linear-gradient(160deg, rgba(19,19,28,0.99), rgba(10,10,15,0.99));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  box-shadow: 0 30px 100px rgba(0,0,0,0.7);
  display: flex; flex-direction: column;
}
.fb-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.fb-head h2 {
  font-size: 1.05em; margin: 0; font-weight: 700;
  background: linear-gradient(135deg, #60a5fa, #34d399);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.fb-close {
  background: transparent; border: 0; color: #888;
  font-size: 1.1em; cursor: pointer; padding: 4px 8px;
  border-radius: 6px;
}
.fb-close:hover { background: rgba(255,255,255,0.06); color: #fff; }

.fb-body {
  padding: 16px 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.fb-label {
  font-size: 0.78em; color: #999; margin-bottom: 6px; font-weight: 600;
}
.fb-shot-wrap {
  background: rgba(255,255,255,0.02);
  border: 1px dashed rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 10px;
}
.fb-shot-preview {
  display: none;
  width: 100%; max-height: 200px;
  object-fit: cover; object-position: top;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.06);
}
.fb-shot-preview.show { display: block; }
.fb-shot-empty {
  text-align: center; color: #666; font-size: 0.82em;
  padding: 30px 0;
}
.fb-shot-empty.hidden { display: none; }

.fb-input-wrap textarea,
.fb-input-wrap input {
  width: 100%;
  padding: 10px 12px;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: #e0e0e0;
  font-family: inherit; font-size: 0.9em;
  resize: vertical;
  box-sizing: border-box;
}
.fb-input-wrap textarea:focus,
.fb-input-wrap input:focus {
  outline: none; border-color: rgba(96,165,250,0.4);
}

.fb-audio-row {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
}
.fb-rec-btn {
  background: rgba(244,63,94,0.12);
  border: 1px solid rgba(244,63,94,0.35);
  color: #fda4af;
  padding: 8px 14px;
  border-radius: 999px;
  font-family: inherit; font-size: 0.84em;
  cursor: pointer;
}
.fb-rec-btn.recording {
  background: #f43f5e; color: white; border-color: #f43f5e;
  animation: fb-pulse 1.2s ease-in-out infinite;
}
@keyframes fb-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(244,63,94,0.6); }
  50%      { box-shadow: 0 0 0 8px rgba(244,63,94,0); }
}
.fb-rec-time {
  font-family: 'SF Mono', monospace; font-size: 0.82em; color: #888;
}
#fb-audio-preview { max-width: 100%; }
.fb-audio-hint { font-size: 0.72em; color: #666; margin-top: 4px; }

.fb-foot {
  padding: 14px 20px 18px;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex; justify-content: flex-end; gap: 10px;
}
.fb-btn {
  padding: 9px 18px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: #e0e0e0; font-family: inherit; font-size: 0.88em; font-weight: 600;
  cursor: pointer;
}
.fb-btn.primary {
  background: linear-gradient(135deg, #60a5fa, #34d399);
  color: #0a0a0f; border-color: transparent; font-weight: 800;
}
.fb-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.fb-status {
  padding: 0 20px 14px; font-size: 0.82em; min-height: 1em;
  text-align: right;
}
.fb-status.ok { color: #34d399; }
.fb-status.err { color: #f87171; }

/* ========== Composer ========== */
/* === F2 · floating suggestion chips above composer === */
.composer-suggestions {
  position: sticky; bottom: 60px; z-index: 24;
  padding: 8px 12px 4px;
  background: linear-gradient(to bottom,
    rgba(10,10,15,0) 0%,
    rgba(10,10,15,0.88) 30%,
    rgba(10,10,15,0.95) 100%);
  pointer-events: none;
}
.composer-suggestions.hidden { display: none; }
.composer-suggestions > * { pointer-events: auto; }
.cs-hint {
  font-size: 0.72em; color: #777; margin-bottom: 6px;
  letter-spacing: 0.3px;
}
.cs-row {
  display: flex; gap: 8px; overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.cs-row::-webkit-scrollbar { display: none; }
.cs-chip {
  flex-shrink: 0;
  padding: 7px 12px;
  background: rgba(251,191,36,0.08);
  border: 1px solid rgba(251,191,36,0.25);
  border-radius: 999px;
  color: #fbbf24;
  font-family: inherit; font-size: 0.78em;
  cursor: pointer; white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
  /* Each chip stays compact (no truncation); the row scrolls horizontally
     to expose all options within the chat-thread width. */
  max-width: 70%;
  overflow: hidden; text-overflow: ellipsis;
}
.cs-chip:hover { background: rgba(251,191,36,0.16); }
.cs-chip:active { transform: scale(0.97); }

.composer {
  position: sticky; bottom: 0; z-index: 25;
  display: flex; align-items: flex-end; gap: 6px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(10,10,15,0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}
.comp-btn {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  cursor: pointer;
  font-size: 1.2em;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: inherit;
  transition: transform 0.1s;
}
.comp-btn:hover, .comp-btn:active { background: rgba(255,255,255,0.08); transform: scale(1.05); }
.comp-btn.mic.recording {
  background: var(--c-sales);
  color: #fff;
  animation: pulseRec 1.2s infinite;
}
@keyframes pulseRec {
  0%, 100% { box-shadow: 0 0 0 0 rgba(244,63,94,0.5); }
  50%      { box-shadow: 0 0 0 8px rgba(244,63,94,0); }
}
.comp-btn.send {
  background: var(--grad-primary);
  color: #0a0a0f;
  border-color: transparent;
}
.comp-btn.send:disabled {
  background: rgba(255,255,255,0.05);
  color: var(--dim-2);
  cursor: not-allowed;
}
.plus-icon { font-size: 1.5em; line-height: 1; font-weight: 300; }

#input {
  flex: 1;
  padding: 10px 14px;
  min-height: 40px;
  max-height: 140px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95em;
  resize: none;
  line-height: 1.4;
}
#input:focus {
  outline: none;
  border-color: rgba(96,165,250,0.4);
  background: rgba(255,255,255,0.06);
}

/* ========== Bottom sheets ========== */
.sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 50;
  background: #13131c;
  border-top: 1px solid var(--border);
  border-radius: 18px 18px 0 0;
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 50px rgba(0,0,0,0.6);
  transform: translateY(0);
  animation: sheetUp 0.22s ease;
}
.sheet.hidden { display: none !important; }
@keyframes sheetUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.sheet-handle {
  width: 40px; height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
  margin: 8px auto 14px;
}
.sheet h3 {
  font-size: 0.85em; color: var(--dim);
  font-weight: 600; text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
  text-align: center;
}
.sheet-sep {
  height: 1px; background: var(--border);
  margin: 10px -16px;
}

/* Attachment grid */
.attach-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.attach-opt {
  padding: 18px 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s;
}
.attach-opt:hover, .attach-opt:active { background: rgba(255,255,255,0.06); }
.attach-ico { font-size: 1.8em; margin-bottom: 6px; }
.attach-lbl { font-size: 0.85em; color: var(--text); font-weight: 600; }

.sheet-close {
  width: 100%;
  padding: 12px; margin-top: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.9em;
  font-family: inherit;
  cursor: pointer;
}

/* Menu items */
.company-list { max-height: 200px; overflow-y: auto; margin: -6px 0 6px; }
.company-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-soft);
  margin-bottom: 5px;
  cursor: pointer;
  font-size: 0.88em;
}
.company-item:hover { background: rgba(255,255,255,0.05); }
.company-item.active {
  background: rgba(96,165,250,0.1);
  border-color: rgba(96,165,250,0.3);
  color: var(--c-blue);
}
.company-item .ci-score {
  font-family: 'SF Mono', monospace;
  font-size: 0.78em; color: var(--c-output);
}
.menu-item {
  display: block; width: 100%;
  padding: 12px 14px; margin-bottom: 4px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.9em;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.menu-item:hover { background: rgba(255,255,255,0.06); }

/* ========== Modal (URL / text input) ========== */
.modal {
  position: fixed; inset: 0;
  z-index: 60;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal.hidden { display: none !important; }
.modal-box {
  background: #13131c;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  width: 100%; max-width: 440px;
}
.modal-box h3 { font-size: 1em; margin-bottom: 12px; }
.modal-box textarea {
  width: 100%; min-height: 80px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit; font-size: 0.95em;
  resize: vertical;
}
.modal-box textarea:focus {
  outline: none;
  border-color: rgba(96,165,250,0.4);
}
.modal-btns { display: flex; gap: 8px; margin-top: 14px; justify-content: flex-end; }
.btn {
  padding: 9px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-family: inherit; font-size: 0.9em;
  cursor: pointer;
}
.btn.primary {
  background: var(--grad-primary);
  color: #0a0a0f;
  border-color: transparent;
  font-weight: 700;
}
.btn.ghost { background: transparent; }

/* ========== Desktop centering ========== */
@media (min-width: 640px) {
  body {
    background: #05050a;
  }
  .chat-header, .thread, .composer, .composer-suggestions {
    max-width: 620px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
  }
  .chat-header, .composer {
    background: rgba(13,13,22,0.96);
  }
  .thread {
    background: var(--bg);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}

/* ========== Agent Hijack card (locked input + button choices) ========== */
.hijack-card {
  margin-top: 8px;
  padding: 14px 16px;
  background: rgba(96,165,250,0.06);
  border: 1px solid rgba(96,165,250,0.3);
  border-radius: 12px;
  box-shadow: 0 0 0 3px rgba(96,165,250,0.08);
}
.hijack-card .hj-title {
  font-size: 0.92em; font-weight: 700;
  color: var(--c-blue);
  margin-bottom: 4px;
}
.hijack-card .hj-sub {
  font-size: 0.82em; color: var(--dim);
  margin-bottom: 12px;
  line-height: 1.5;
}
.hijack-card .hj-options {
  display: flex; flex-direction: column; gap: 6px;
}
.hijack-card .hj-btn {
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.88em;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
}
.hijack-card .hj-btn:hover:not(:disabled) {
  background: rgba(96,165,250,0.08);
  border-color: rgba(96,165,250,0.4);
}
.hijack-card .hj-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.hijack-card .hj-btn.picked {
  background: var(--grad-primary);
  color: #0a0a0f;
  border-color: transparent;
  font-weight: 700;
  opacity: 1;
}

/* Locked composer state (visual cue) */
.composer.locked {
  opacity: 0.55;
  pointer-events: none;
}
.composer.locked #input {
  font-style: italic;
  color: var(--dim-2);
}

/* ========== Referral nudge card (peak-delight moment in G) ========== */
.referral-card {
  margin-top: 8px;
  padding: 16px 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(52,211,153,0.1), rgba(96,165,250,0.08));
  border: 1px solid rgba(52,211,153,0.35);
  box-shadow: 0 0 0 3px rgba(52,211,153,0.08);
  animation: rcFadeIn 0.5s ease;
}
@keyframes rcFadeIn {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.referral-card .rc-sparkle {
  font-size: 1.8em; line-height: 1; margin-bottom: 4px;
}
.referral-card .rc-title {
  font-weight: 800; font-size: 1em;
  background: var(--grad-primary);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
}
.referral-card .rc-sub {
  font-size: 0.85em; color: #bbb;
  line-height: 1.6; margin-bottom: 12px;
}
.referral-card .rc-actions {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.referral-card .rc-btn {
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit; font-size: 0.85em;
  cursor: pointer;
}
.referral-card .rc-btn:hover { background: rgba(255,255,255,0.08); }
.referral-card .rc-btn.primary {
  background: var(--grad-primary);
  color: #0a0a0f;
  border-color: transparent;
  font-weight: 700;
}
.referral-card .rc-btn.ghost {
  background: transparent;
  color: var(--dim);
}

/* ========== Agent 2 · Update Plan review card ========== */
.update-plan-card {
  margin-top: 8px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(96,165,250,0.06);
  border: 1px solid rgba(96,165,250,0.3);
}
.update-plan-card .up-title {
  font-weight: 800; font-size: 0.95em;
  color: var(--c-blue);
  margin-bottom: 4px;
}
.update-plan-card .up-sub {
  font-size: 0.82em; color: var(--dim);
  margin-bottom: 10px;
  line-height: 1.6;
}
.update-plan-card .up-sub b { color: var(--c-sales); }
.update-plan-card .up-chunks {
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 10px;
  max-height: 220px;
  overflow-y: auto;
}
.update-plan-card .up-chunk {
  padding: 5px 0;
  border-bottom: 1px dashed var(--border-soft);
  font-size: 0.82em;
  line-height: 1.5;
  color: #bbb;
}
.update-plan-card .up-chunk:last-child { border-bottom: 0; }
.update-plan-card .up-tag {
  display: inline-block;
  padding: 1px 7px;
  margin-right: 6px;
  border-radius: 4px;
  font-size: 0.8em;
  font-family: 'SF Mono', monospace;
  font-weight: 600;
}
.update-plan-card .up-tag.cp { background: rgba(52,211,153,0.15); color: var(--c-output); }
.update-plan-card .up-tag.os { background: rgba(251,191,36,0.15); color: var(--c-input); }
.update-plan-card .up-actions {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 8px;
}
.update-plan-card .up-btn {
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit; font-size: 0.85em;
  cursor: pointer;
}
.update-plan-card .up-btn:hover { background: rgba(255,255,255,0.08); }
.update-plan-card .up-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.update-plan-card .up-btn.primary {
  background: var(--grad-primary);
  color: #0a0a0f;
  border-color: transparent;
  font-weight: 700;
}
.update-plan-card .up-btn.danger {
  background: rgba(244,63,94,0.1);
  border-color: rgba(244,63,94,0.3);
  color: var(--c-sales);
}
.update-plan-card .up-note {
  font-size: 0.72em; color: var(--dim-2);
  font-style: italic;
}

/* ========== Typing caret (streaming chars, demo only) ========== */
.msg .caret {
  display: inline-block;
  width: 0.5em;
  color: var(--c-blue);
  animation: caretBlink 0.9s steps(1) infinite;
  vertical-align: baseline;
  font-weight: 700;
  margin-left: 1px;
}
@keyframes caretBlink {
  0%, 50%   { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}
.msg-chips-after {
  animation: chipsFadeIn 0.35s ease;
}
@keyframes chipsFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* DEV-mode menu item */
.menu-item.dev {
  background: rgba(251,191,36,0.08);
  border-color: rgba(251,191,36,0.25);
  color: #fbbf24;
  font-family: 'SF Mono', monospace;
  font-size: 0.85em;
}
.menu-item.dev:hover { background: rgba(251,191,36,0.15); }

/* ============================================================
   Welcome modal — shown on first landing (per plan: value-first)
   ============================================================ */
.welcome-modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.welcome-modal.hidden { display: none !important; }
.wm-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: wmFade 0.35s ease;
}
@keyframes wmFade { from { opacity:0; } to { opacity:1; } }
.wm-box {
  position: relative; z-index: 1;
  max-width: 520px; width: 100%;
  background: linear-gradient(160deg, rgba(19,19,28,0.98), rgba(10,10,15,0.98));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 32px 28px 20px;
  box-shadow: 0 25px 80px rgba(0,0,0,0.6);
  animation: wmRise 0.4s cubic-bezier(.2,.8,.3,1);
}
@keyframes wmRise {
  from { opacity:0; transform: translateY(20px) scale(0.96); }
  to   { opacity:1; transform: translateY(0) scale(1); }
}
.wm-tag {
  display: inline-block;
  font-size: 0.7em; letter-spacing: 2px; text-transform: uppercase;
  font-weight: 700;
  background: rgba(52,211,153,0.15); color: #34d399;
  padding: 4px 10px; border-radius: 6px;
  margin-bottom: 16px;
}
.wm-title {
  font-size: 1.5em; font-weight: 800; line-height: 1.3;
  background: var(--grad-primary);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}
.wm-sub {
  color: #aaa; font-size: 0.92em; line-height: 1.55;
  margin-bottom: 20px;
}
.wm-perks {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 24px;
}
.wm-perk {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
}
.wm-perk .wm-ico {
  grid-row: 1 / span 2;
  font-size: 2em;
  line-height: 1;
  align-self: center;
}
.wm-perk-title {
  font-weight: 700; font-size: 0.95em; color: #e0e0e0;
  grid-column: 2;
}
.wm-perk-sub {
  grid-column: 2;
  color: #888; font-size: 0.8em;
  line-height: 1.5;
}

.wm-actions {
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 14px;
}
.wm-actions-2col {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 12px;
  margin-bottom: 12px;
}
@media (max-width: 520px) {
  .wm-actions-2col { grid-template-columns: 1fr; }
}
.wm-actions-2col .wm-btn {
  display: grid;
  grid-template-rows: auto auto auto;
  text-align: center;
  padding: 18px 14px;
  gap: 4px;
  line-height: 1.3;
}
.wm-actions-2col .wm-btn-icon { font-size: 1.6em; }
.wm-actions-2col .wm-btn-main { font-weight: 800; font-size: 0.98em; }
.wm-actions-2col .wm-btn-sub  { font-size: 0.74em; opacity: 0.75; font-weight: 500; }
.wm-btn.login-cta {
  background: linear-gradient(160deg, rgba(167,139,250,0.18), rgba(96,165,250,0.12));
  border-color: rgba(167,139,250,0.45);
  color: #c4b5fd;
}
.wm-btn.login-cta:hover {
  background: linear-gradient(160deg, rgba(167,139,250,0.28), rgba(96,165,250,0.20));
  border-color: rgba(167,139,250,0.7);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(167,139,250,0.25);
}

/* ============ Login-code modal (Z0 / A6) ============ */
.lcm-input-wrap, .lcm-pwd-wrap {
  margin-bottom: 12px;
}
.lcm-input-row {
  display: flex; gap: 8px; align-items: stretch;
}
.lcm-input-row .lcm-input { flex: 1; }
.lcm-paste-btn {
  flex-shrink: 0;
  padding: 0 14px;
  background: rgba(167,139,250,0.15);
  border: 1.5px solid rgba(167,139,250,0.3);
  border-radius: 10px;
  color: #c4b5fd;
  font-family: inherit;
  font-size: 0.86em;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.lcm-paste-btn:hover {
  background: rgba(167,139,250,0.25);
  border-color: rgba(167,139,250,0.6);
  transform: translateY(-1px);
}
.lcm-paste-btn:active { transform: scale(0.97); }
.lcm-paste-btn.pasted {
  background: rgba(52,211,153,0.18);
  border-color: #34d399;
  color: #34d399;
}
.lcm-input {
  width: 100%;
  padding: 14px 16px;
  background: rgba(0,0,0,0.4);
  border: 1.5px solid rgba(167,139,250,0.3);
  border-radius: 10px;
  font-family: 'SF Mono', monospace;
  font-size: 1.05em; letter-spacing: 1.5px;
  color: #e0e0e0;
  text-align: center;
  text-transform: uppercase;
  transition: border-color 0.15s, background 0.15s;
}
.lcm-pwd-wrap .lcm-input {
  letter-spacing: 1px;
  text-transform: none;
  font-family: inherit;
}
.lcm-input:focus {
  outline: 0;
  border-color: rgba(167,139,250,0.7);
  background: rgba(0,0,0,0.6);
}
.lcm-input.error {
  border-color: rgba(244,63,94,0.7);
  animation: lcmShake 0.4s;
}
@keyframes lcmShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.lcm-status {
  font-size: 0.8em;
  text-align: center;
  min-height: 18px;
  margin-bottom: 10px;
  color: #888;
}
.lcm-status.error { color: #fb7185; }
.lcm-status.ok    { color: #34d399; }
.lcm-status.loading { color: #c4b5fd; }
.wm-btn {
  padding: 14px 22px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-family: inherit;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
}
.wm-btn:hover { background: rgba(255,255,255,0.08); }
.wm-btn:active { transform: scale(0.98); }
.wm-btn.primary {
  background: var(--grad-primary);
  color: #0a0a0f;
  border-color: transparent;
  font-weight: 800;
  box-shadow: 0 6px 22px rgba(52,211,153,0.3);
}
.wm-btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(52,211,153,0.42);
}
.wm-footer {
  text-align: center;
  font-size: 0.75em; color: #555;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.wm-footer a {
  color: #a78bfa;
  text-decoration: none;
  margin: 0 4px;
  font-family: 'SF Mono', monospace;
  font-size: 0.95em;
}
.wm-footer a:hover { color: #c3b5f0; text-decoration: underline; }
.wm-footer .wm-dot { color: #333; }

@media (max-width: 520px) {
  .wm-box { padding: 26px 20px 16px; border-radius: 16px; }
  .wm-title { font-size: 1.25em; }
  .wm-perk { padding: 12px 14px; }
  .wm-perk .wm-ico { font-size: 1.6em; }
}

/* Welcome modal — mandatory-demo refinements */
.wm-btn.big {
  padding: 18px 28px;
  font-size: 1.1em;
}
.wm-hint {
  text-align: center;
  margin: 8px 0 14px;
  font-size: 0.82em;
  color: var(--dim);
  font-style: italic;
}

/* ============================================================
   Completeness-100 milestone · confetti + unlock card
   ============================================================ */
.milestone-card {
  margin-top: 8px;
  padding: 20px 22px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(251,191,36,0.12), rgba(52,211,153,0.12), rgba(96,165,250,0.12));
  border: 1.5px solid rgba(52,211,153,0.5);
  box-shadow: 0 0 0 4px rgba(52,211,153,0.08), 0 10px 30px rgba(0,0,0,0.4);
  animation: msRise 0.55s cubic-bezier(.2,.9,.3,1.1);
}
@keyframes msRise {
  from { opacity: 0; transform: translateY(14px) scale(0.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.milestone-card .ms-sparkle {
  font-size: 1.7em; letter-spacing: 6px;
  margin-bottom: 6px;
}
.milestone-card .ms-title {
  font-weight: 800; font-size: 1.35em;
  background: var(--grad-primary);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: 4px;
}
.milestone-card .ms-sub {
  color: #ccc; font-size: 0.92em; line-height: 1.5;
  margin-bottom: 14px;
}
.milestone-card .ms-perks {
  display: flex; flex-direction: column;
  gap: 6px; margin-bottom: 16px;
}
.milestone-card .ms-perk {
  display: flex; gap: 10px;
  font-size: 0.88em; color: #c4d6f0; line-height: 1.5;
}
.milestone-card .ms-perk b {
  color: var(--c-output);
}
.milestone-card .ms-check {
  width: 20px; height: 20px; flex-shrink: 0;
  border-radius: 50%;
  background: rgba(52,211,153,0.2);
  color: var(--c-output);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.78em;
}
.milestone-card .ms-actions {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.milestone-card .ms-btn {
  padding: 10px 18px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit; font-size: 0.88em; font-weight: 600;
  cursor: pointer;
}
.milestone-card .ms-btn:hover { background: rgba(255,255,255,0.08); }
.milestone-card .ms-btn.primary {
  background: var(--grad-primary);
  color: #0a0a0f;
  border-color: transparent;
  font-weight: 800;
  box-shadow: 0 4px 18px rgba(52,211,153,0.3);
}

/* Confetti */
.confetti-layer {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 999;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  top: -20px;
  width: 9px; height: 14px;
  opacity: 0.9;
  border-radius: 2px;
  animation-name: confettiFall;
  animation-timing-function: cubic-bezier(.2,.7,.5,1);
  animation-fill-mode: forwards;
}
@keyframes confettiFall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ============ Platform stats card (I stage) ============ */
.platform-stats-card {
  margin-top: 8px;
  padding: 18px 20px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(96,165,250,0.08), rgba(52,211,153,0.06));
  border: 1px solid rgba(96,165,250,0.25);
}
.platform-stats-card .ps-title {
  font-weight: 700; font-size: 0.95em; color: #e0e0e0; margin-bottom: 10px;
}
.platform-stats-card .ps-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  margin-bottom: 12px;
}
@media (max-width: 520px) {
  .platform-stats-card .ps-grid { grid-template-columns: repeat(2, 1fr); }
}
.platform-stats-card .ps-kpi {
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 10px 12px; text-align: center;
}
.platform-stats-card .ps-val {
  font-weight: 800; font-size: 1.5em;
  background: var(--grad-primary);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  font-family: 'SF Mono', monospace;
}
.platform-stats-card .ps-lbl {
  font-size: 0.72em; color: var(--dim); margin-top: 4px;
  letter-spacing: 1px; text-transform: uppercase;
}
.platform-stats-card .ps-foot {
  font-size: 0.82em; color: #aaa; text-align: center;
  padding: 6px 0 8px;
  border-top: 1px dashed rgba(255,255,255,0.08);
  margin-top: 4px;
}
.platform-stats-card .ps-foot b { color: var(--c-output); }
.platform-stats-card .ps-teaser {
  margin-top: 10px; padding: 10px 12px;
  border-radius: 10px;
  background: rgba(167,139,250,0.08);
  border: 1px dashed rgba(167,139,250,0.3);
}
.platform-stats-card .ps-teaser-title {
  font-size: 0.78em; font-weight: 700; color: #a78bfa;
  margin-bottom: 4px; letter-spacing: 1px;
}
.platform-stats-card .ps-teaser-body {
  font-size: 0.82em; color: #aaa; line-height: 1.55;
}

/* ============ zh/en language toggle · scoped CSS-only visibility ============ */
body.lang-zh .en { display: none !important; }
body.lang-zh .zh { display: initial; }
body.lang-en .zh { display: none !important; }
body.lang-en .en { display: initial; }
/* default (neither class present) → zh */
body:not(.lang-en) .en { display: none; }

/* K-stage · quota badge in header (always visible per spec) */
.quota-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  font-size: 0.72em; font-weight: 600;
  border-radius: 12px;
  background: rgba(52,211,153,0.1);
  border: 1px solid rgba(52,211,153,0.3);
  color: var(--c-output);
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.quota-badge .qb-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--c-output);
  animation: qbPulse 2s ease-in-out infinite;
}
@keyframes qbPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52,211,153,0.4); }
  50%      { box-shadow: 0 0 0 4px rgba(52,211,153,0); }
}
@media (max-width: 420px) {
  .quota-badge { padding: 3px 7px; font-size: 0.68em; }
  .quota-badge .qb-dot { width: 5px; height: 5px; }
}

/* ========== Variant color themes · selectable via /api/settings ========== */
/* v1 is the default (already in :root) — these are overrides when body gets a theme-vN class */

body.theme-v2 {   /* Navy Enterprise · deep blue + gold accent */
  --bg: #0a0f1e; --text: #e6ecf5;
  --c-input: #d4a04a; --c-process: #7ba4ff; --c-output: #4a88d4;
  --c-sales: #d45555; --c-blue: #6b93d8;
  --grad-primary: linear-gradient(135deg, #4a88d4, #d4a04a);
}
body.theme-v3 {   /* Emerald Growth · green primary + amber warm */
  --bg: #061310; --text: #e0ebe5;
  --c-input: #f0b040; --c-process: #78c895; --c-output: #1da47a;
  --c-sales: #e85f5c; --c-blue: #3ea8d4;
  --grad-primary: linear-gradient(135deg, #1da47a, #f0b040);
}
body.theme-v4 {   /* Warm Earth · clay + terracotta */
  --bg: #1a1310; --text: #ead8c7;
  --c-input: #d98f52; --c-process: #a68568; --c-output: #8ba872;
  --c-sales: #c85a3f; --c-blue: #6b93a8;
  --grad-primary: linear-gradient(135deg, #c85a3f, #d98f52);
}
body.theme-v5 {   /* Mono Graphite · near-black + single accent */
  --bg: #0d0d0f; --text: #e5e5e8;
  --c-input: #888888; --c-process: #999999; --c-output: #cccccc;
  --c-sales: #ffffff; --c-blue: #aaaaaa;
  --grad-primary: linear-gradient(135deg, #999999, #ffffff);
}

/* ========== Stage pill · responsive · avoids overflow on narrow screens ========== */
.stage-pill .stage-label {
  max-width: 50vw;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: inline-block;
}
@media (max-width: 420px) {
  .stage-pill .stage-label {
    font-size: 0.72em;
    padding: 3px 9px;
    max-width: 45vw;
  }
  .quota-badge { max-width: 35vw; overflow: hidden; text-overflow: ellipsis; }
}

/* Smooth transition on stage color change */
.stage-pill .stage-label {
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

/* Follow-up suggestions · appear under Golden-Rule refusals so buyer
   never hits a dead-end */
.followup-row {
  margin-top: 8px;
  padding: 10px 12px;
  background: rgba(96,165,250,0.06);
  border: 1px solid rgba(96,165,250,0.2);
  border-radius: 10px;
}
.followup-hint {
  font-size: 0.75em; color: var(--c-blue);
  font-weight: 600; margin-bottom: 6px;
  letter-spacing: 0.3px;
}
.followup-chip {
  display: inline-block;
  margin: 3px 6px 3px 0;
  padding: 6px 12px;
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(96,165,250,0.3);
  color: var(--c-blue);
  font-family: inherit;
  font-size: 0.82em;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.followup-chip:hover {
  background: rgba(96,165,250,0.12);
  transform: translateY(-1px);
}

/* Completeness progress bar · smooth bump animation + celebration flash
   when crossing a tier threshold (34 → 67 → 100). */
.stage-pill .stage-label {
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
@keyframes tierPulse {
  0%   { box-shadow: 0 0 0 0 rgba(52,211,153,0); transform: scale(1); }
  30%  { box-shadow: 0 0 0 8px rgba(52,211,153,0.35); transform: scale(1.08); }
  100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); transform: scale(1); }
}
.stage-pill.bumping .stage-label {
  animation: tierPulse 0.9s ease-out;
}
.progress-inline .p-fill {
  transition: width 0.8s cubic-bezier(.2,.8,.3,1);
}
.progress-inline .p-val {
  transition: color 0.3s ease, transform 0.3s ease;
}
.progress-inline .p-val.bumped {
  color: #34d399 !important;
  transform: scale(1.2);
  text-shadow: 0 0 10px rgba(52,211,153,0.5);
}
