/* Hero chat: scenarios, live relay, plan card (index3) */
.chat { --role-design: #9b7bff; --role-dev: #5aa9ff; --role-seo: #38c9d4; display: flex; flex-direction: column; }
.chat-head .chat-status { color: var(--muted); }

.chat-tabs { display: flex; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--ground-2); overflow-x: auto; scrollbar-width: none; }
.chat-tabs::-webkit-scrollbar { display: none; }
.chat-tabs [role="tab"] {
  flex: 0 0 auto; min-height: 36px; padding: 6px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-2); background: transparent; color: var(--muted);
  font: 600 0.9375rem/1 var(--display); letter-spacing: 0.04em; text-transform: uppercase;
  transition: color .2s, background-color .2s, border-color .2s;
}
.chat-tabs [role="tab"]:hover { color: var(--text); border-color: var(--muted); }
.chat-tabs [role="tab"][aria-selected="true"] { background: var(--grad); border-color: transparent; color: #fff; }

.chat-log {
  height: 440px; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 10px; padding: 18px 18px 14px;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.chat-log > :first-child { margin-top: auto; }

/* Bubbles: the visitor on the right, Aman on the left */
.chat .msg { max-width: 84%; padding: 10px 14px 8px; border-radius: 14px; font-size: 0.96875rem; line-height: 1.45; position: relative; }
.chat .msg p { margin: 0; }
.chat .msg-client { align-self: flex-end; background: #233046; border: 1px solid #2c3b55; border-bottom-right-radius: 4px; }
.chat .msg-aman { align-self: flex-start; background: #1a2230; border: 1px solid var(--line-2); border-bottom-left-radius: 4px; }
.msg-meta { display: flex; justify-content: flex-end; align-items: center; gap: 4px; margin-top: 2px; font-size: 0.6875rem; color: var(--dim); font-variant-numeric: tabular-nums; }
.msg-client .ticks { color: var(--accent); }

.chat .msg-typing { display: inline-flex; gap: 5px; padding: 14px 16px; }
.msg-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: typing 1.1s infinite ease-in-out; }
.msg-typing span:nth-child(2) { animation-delay: .15s; }
.msg-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* Relay pill: Aman briefing the team */
.relay {
  align-self: center; display: inline-flex; align-items: center; gap: 10px; max-width: 100%;
  padding: 7px 14px; border-radius: 999px; border: 1px dashed var(--line-2);
  font-size: 0.8125rem; color: var(--muted); background: rgba(90, 169, 255, 0.06);
}
.relay.is-done { border-style: solid; border-color: rgba(76, 210, 131, 0.45); color: var(--text); background: rgba(76, 210, 131, 0.08); }
.relay-dots { display: inline-flex; flex: none; }
.relay-dots i, .plan-team i { display: block; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--board); margin-left: -6px; }
.relay-dots i:first-child, .plan-team i:first-child { margin-left: 0; }
i[data-role="design"], .tm[data-role="design"] i { background: var(--role-design); }
i[data-role="dev"], .tm[data-role="dev"] i { background: var(--role-dev); }
i[data-role="seo"], .tm[data-role="seo"] i { background: var(--role-seo); }
.relay.is-working .relay-dots i { animation: relay-ping 1s ease-in-out infinite; }
.relay.is-working .relay-dots i:nth-child(2) { animation-delay: .2s; }
.relay.is-working .relay-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes relay-ping { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.25); } }

/* Plan card */
.plan { align-self: stretch; margin-inline: 4px; border-radius: 12px; overflow: hidden; background: #121821; border: 1px solid var(--line-2); flex: none; }
.plan-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: linear-gradient(110deg, rgba(45, 111, 214, .18), rgba(106, 69, 216, .18)); }
.plan-head strong { font: 700 1.0625rem/1.1 var(--display); letter-spacing: .04em; text-transform: uppercase; }
.plan-head span { font: 600 0.75rem/1 var(--display); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.plan-rows { list-style: none; margin: 0; padding: 6px 16px; }
.plan-rows li { display: grid; grid-template-columns: minmax(0, 9.5rem) minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 0.875rem; }
.plan-rows li:last-child { border-bottom: 0; }
.plan-rows li.has-state { grid-template-columns: minmax(0, 1fr) auto; }
.plan-name { color: var(--text); }
.plan-bar { position: relative; height: 8px; border-radius: 999px; background: #1f2834; }
.plan-bar i { position: absolute; top: 0; bottom: 0; border-radius: 999px; background: var(--grad); transform-origin: left center; transition: transform .8s var(--ease); }
.plan-bar i.is-end { background: var(--green); }
.plan.is-building .plan-bar i { transform: scaleX(0); }
.plan-when { font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 4.2rem; text-align: right; }
.plan-state { font: 600 0.75rem/1 var(--display); letter-spacing: .08em; text-transform: uppercase; padding: 5px 9px; border-radius: 4px; white-space: nowrap; }
.plan-state.is-now { color: #0b1220; background: var(--accent); }
.plan-state.is-next { color: var(--muted); border: 1px solid var(--line-2); }
.plan-foot { display: flex; align-items: center; gap: 12px; padding: 10px 16px 12px; border-top: 1px solid var(--line); font-size: 0.8125rem; color: var(--muted); }
.plan-team { display: inline-flex; flex: none; }

/* Team strip: who Aman is briefing, live */
.chat-team { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--ground-2); }
.chat-team-label { font: 600 0.75rem/1 var(--display); letter-spacing: .12em; text-transform: uppercase; color: var(--dim); margin-right: auto; }
.tm { display: inline-flex; align-items: center; gap: 7px; font-size: 0.8125rem; color: var(--dim); transition: color .3s; }
.tm i { position: relative; display: block; width: 10px; height: 10px; border-radius: 50%; opacity: .45; transition: opacity .3s, background-color .3s; }
.tm[data-state="working"], .tm[data-state="done"] { color: var(--text); }
.tm[data-state="working"] i { opacity: 1; animation: tm-pulse 1.1s ease-out infinite; }
.tm[data-state="done"] i { opacity: 1; background: var(--green); }
.tm[data-state="done"] i::after { content: ""; position: absolute; left: 3.5px; top: 1.5px; width: 2.5px; height: 5px; border: solid #0b1220; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
@keyframes tm-pulse { 0% { box-shadow: 0 0 0 0 rgba(90, 169, 255, .55); } 100% { box-shadow: 0 0 0 9px rgba(90, 169, 255, 0); } }

/* Entrances: from an almost-visible state, ease-out */
@media (prefers-reduced-motion: no-preference) {
  .chat-log .in { animation: chat-in .38s var(--ease) both; }
  @keyframes chat-in { from { opacity: .2; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
}
@media (prefers-reduced-motion: reduce) {
  .msg-typing span, .relay-dots i, .tm i { animation: none !important; }
}

@media (max-width: 640px) {
  .chat-log { height: 460px; padding: 14px 12px; }
  .chat .msg { max-width: 90%; }
  .plan-rows li { grid-template-columns: minmax(0, 6.5rem) minmax(0, 1fr) auto; gap: 8px; }
  .plan-foot { align-items: flex-start; }
  .chat-team-label { width: 100%; margin-right: 0; }
}


/* ---------- WhatsApp-style skin (dark) ---------- */
.hero-chat-wrap { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.hero-chat-wrap .chat-tabs { padding: 0; border: 0; background: transparent; }

.chat {
  --wa-bg: #0b141a; --wa-bar: #202c33; --wa-in: #202c33; --wa-out: #005c4b;
  --wa-text: #e9edef; --wa-sub: #8696a0; --wa-tick: #53bdeb; --wa-green: #00a884; --wa-chip: #182229;
  background: var(--wa-bg); color: var(--wa-text);
  border: 1px solid #222d34; border-image: none; border-radius: 16px; overflow: hidden;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .25), 0 24px 48px rgba(0, 0, 0, .45);
}
.chat .chat-head { gap: 10px; padding: 10px 14px; background: var(--wa-bar); border-bottom: 0; }
.wa-icon { color: var(--wa-sub); flex: none; display: block; }
.wa-back { margin-right: -4px; }
.chat .chat-avatar { width: 40px; height: 40px; background: #111b21; border: 0; }
.chat .chat-who strong { font: 500 1rem/1.25 var(--body); letter-spacing: 0; text-transform: none; color: var(--wa-text); }
.chat .chat-status { font-size: 0.8125rem; color: var(--wa-sub); }
.wa-actions { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.chat .live { display: none; }

.chat .chat-log {
  background-color: var(--wa-bg);
  background-image: radial-gradient(rgba(134, 150, 160, .07) 1px, transparent 1.2px);
  background-size: 18px 18px;
  gap: 4px; padding: 12px 16px;
}
.day-chip {
  align-self: center; margin: 4px 0 8px; padding: 5px 12px; border-radius: 8px;
  background: var(--wa-chip); color: var(--wa-sub); font-size: 0.75rem; letter-spacing: .02em; text-transform: uppercase;
  box-shadow: 0 1px .5px rgba(11, 20, 26, .13);
}

/* Bubbles with tails, meta inside the bubble */
.chat .msg { padding: 6px 9px 8px 10px; border: 0; border-radius: 8px; font-size: 0.9375rem; line-height: 1.38; color: var(--wa-text); box-shadow: 0 1px .5px rgba(11, 20, 26, .13); margin-top: 6px; }
.chat .msg p { display: inline; }
.chat .msg-meta { float: right; margin: 6px 0 -4px 10px; position: relative; top: 2px; font-size: 0.6875rem; color: rgba(233, 237, 239, .6); gap: 3px; }
.chat .msg::after { content: ""; display: table; clear: both; }
.chat .msg-client { background: var(--wa-out); border-top-right-radius: 0; }
.chat .msg-aman { background: var(--wa-in); border-top-left-radius: 0; }
.chat .msg-client::before, .chat .msg-aman::before { content: ""; position: absolute; top: 0; width: 8px; height: 13px; }
.chat .msg-client::before { right: -8px; background: var(--wa-out); clip-path: polygon(0 0, 100% 0, 0 100%); }
.chat .msg-aman::before { left: -8px; background: var(--wa-in); clip-path: polygon(0 0, 100% 0, 100% 100%); }
.chat .msg-client .ticks { color: var(--wa-tick); }
.chat .msg-typing { padding: 12px 14px; }
.chat .msg-typing span { background: var(--wa-sub); }

/* Briefing notice as a system message */
.chat .relay {
  margin: 8px 0 4px; border: 0; border-radius: 8px; padding: 6px 12px;
  background: var(--wa-chip); color: var(--wa-sub); font-size: 0.78125rem;
}
.chat .relay.is-done { background: var(--wa-chip); color: #d1d7db; box-shadow: inset 0 0 0 1px rgba(0, 168, 132, .35); }
.chat .relay-dots i, .chat .plan-team i { border-color: var(--wa-chip); }

/* Plan card as a rich incoming message */
.chat .plan {
  align-self: flex-start; max-width: 92%; width: 100%; margin: 6px 0 0; padding: 4px;
  background: var(--wa-in); border: 0; border-radius: 8px; border-top-left-radius: 0; position: relative;
  box-shadow: 0 1px .5px rgba(11, 20, 26, .13);
}
.chat .plan::before { content: ""; position: absolute; top: 0; left: -8px; width: 8px; height: 13px; background: var(--wa-in); clip-path: polygon(0 0, 100% 0, 100% 100%); }
.chat .plan-head { border-radius: 6px 6px 0 0; border-bottom: 0; background: #111b21; box-shadow: inset 3px 0 0 var(--wa-green); }
.chat .plan-head strong { font: 600 0.9375rem/1.2 var(--body); letter-spacing: 0; text-transform: none; }
.chat .plan-head span { color: var(--wa-green); font: 600 0.6875rem/1 var(--body); letter-spacing: .08em; }
.chat .plan-rows { background: #111b21; padding: 2px 12px 6px; border-radius: 0 0 6px 6px; }
.chat .plan-rows li { border-bottom-color: #222d34; padding: 7px 0; }
.chat .plan-bar { background: #2a3942; }
.chat .plan-bar i { background: linear-gradient(90deg, #00a884, #53bdeb); }
.chat .plan-bar i.is-end { background: #53bdeb; }
.chat .plan-state.is-now { background: var(--wa-green); color: #0b141a; }
.chat .plan-state.is-next { border-color: #2a3942; color: var(--wa-sub); }
.chat .plan-when { color: var(--wa-sub); }
.chat .plan-foot { border-top: 0; padding: 8px 8px 4px; color: var(--wa-sub); font-size: 0.78125rem; }

/* Input bar */
.wa-input { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--wa-bar); }
.wa-field { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 12px; border-radius: 21px; background: #2a3942; color: var(--wa-sub); font-size: 0.9375rem; }
.wa-field span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-mic { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--wa-green); color: #0b141a; }

/* Team strip under the phone chat */
.chat .chat-team { background: #111b21; border-top: 1px solid #222d34; }
.chat .chat-team-label { color: var(--wa-sub); }
.chat .tm { color: var(--wa-sub); }
.chat .tm[data-state="working"], .chat .tm[data-state="done"] { color: var(--wa-text); }
.chat .tm[data-state="done"] i { background: var(--wa-green); }

@media (max-width: 960px) {
  .hero .hero-chat-wrap { order: 4; }
}
@media (max-width: 640px) {
  .wa-actions { gap: 14px; }
  .wa-actions .wa-icon:first-child { display: none; }
}
