:root {
  --ink: #111214; --ink-2: #2C2F36; --paper: #F2F0E9; --white: #fff; --sand: #D9C8A5; --sand-2: #E8DCC2;
  --accent: #9A7B4F; --muted: #6A6965; --line: rgba(17,18,20,.10);
  --night: #0D0E11; --night-2: #15171C; --night-3: #1D2027; --nline: rgba(242,240,233,.09);
  --ntext: #F2F0E9; --nmuted: #A3A7B0; --green: #8BD3A0;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --r: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--night);
  color: var(--ntext);
  font: 14px/1.5 'Plus Jakarta Sans', system-ui, sans-serif;
  overflow: hidden;
}
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.top {
  height: 64px; display: flex; align-items: center; gap: 20px; padding: 0 22px;
  border-bottom: 1px solid var(--nline); background: rgba(13,14,17,.92); backdrop-filter: blur(8px);
  position: relative; z-index: 5;
}
.brand { color: var(--ntext); text-decoration: none; font-weight: 800; font-size: 20px; letter-spacing: -.04em; }
.brand span { color: var(--sand); }
.topTitle { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.topTitle strong { font-size: 15px; white-space: nowrap; }
.live { display: inline-flex; align-items: center; gap: 7px; font: 600 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--green); padding: 6px 10px; border-radius: 99px; background: rgba(139,211,160,.1); white-space: nowrap; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(139,211,160,.6); animation: ping 1.8s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 8px rgba(139,211,160,0); } 100% { box-shadow: 0 0 0 0 rgba(139,211,160,0); } }
.topActions { display: flex; gap: 8px; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 15px; border-radius: 99px; border: 1px solid transparent; font-weight: 700; font-size: 13px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform .2s ease, background .2s ease; }
.btn:hover { transform: translateY(-1px); }
.btn.ghost { background: rgba(242,240,233,.06); border-color: rgba(242,240,233,.16); color: var(--ntext); }
.btn.light { background: var(--paper); color: var(--ink); }
.btn.small { padding: 6px 11px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }

.tabs { display: none; }

/* ---------- stage ---------- */
.stage { height: calc(100vh - 64px); display: grid; grid-template-columns: minmax(380px, 0.82fr) 1.18fr; }
.client, .panel { min-height: 0; overflow-y: auto; padding: 18px 20px 26px; }
.client { background: radial-gradient(900px 500px at 20% 0%, rgba(217,200,165,.12), transparent 60%), #17181C; }
.panel { background: radial-gradient(900px 600px at 90% 0%, rgba(154,123,79,.16), transparent 60%), var(--night); }
.paneLabel { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font: 600 11px/1.2 var(--mono); text-transform: uppercase; letter-spacing: .07em; color: var(--nmuted); }
.paneLabel span { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--sand); color: var(--ink); font-size: 10.5px; }
.paneLabel em { margin-left: auto; font-style: normal; color: var(--sand); text-transform: none; letter-spacing: 0; }

/* ---------- client: browser mock ---------- */
.browser { border-radius: 16px; overflow: hidden; background: var(--paper); color: var(--ink); box-shadow: 0 30px 80px rgba(0,0,0,.45); display: flex; flex-direction: column; height: calc(100% - 36px); min-height: 560px; }
.browserBar { display: flex; align-items: center; gap: 6px; padding: 10px 12px; background: #E4E1D8; border-bottom: 1px solid var(--line); }
.browserBar i { width: 10px; height: 10px; border-radius: 50%; background: rgba(17,18,20,.16); }
.url { margin-left: 8px; padding: 4px 12px; border-radius: 99px; background: rgba(255,255,255,.75); font: 500 11.5px/1.3 var(--mono); color: var(--ink-2); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.url em { font-style: normal; color: var(--accent); margin-left: 6px; }
.site { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.siteHero { position: relative; padding: 18px 20px 20px; background: #1B1C20; color: var(--paper); overflow: hidden; }
.heroDots { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .55; }
.siteHero > *:not(canvas) { position: relative; }
.siteNav { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 12px; color: #CBC6B8; margin-bottom: 14px; }
.siteNav strong { color: var(--paper); font-size: 15px; letter-spacing: -.02em; }
.siteNav span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.siteHero h1 { margin: 0 0 6px; font-size: clamp(1.3rem, 2.2vw, 1.75rem); line-height: 1.12; letter-spacing: -.035em; }
.siteHero h1 span { color: var(--sand); }
.siteHero p { margin: 0; font-size: 12.5px; color: #B9B4A6; }

.chat { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--paper); }
.chatHead { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fff; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--sand); font-weight: 800; font-size: 12.5px; }
.chatHead strong { display: block; font-size: 14px; }
.chatHead small { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11.5px; }
.chatHead small i { width: 7px; height: 7px; border-radius: 50%; background: #2E9E5B; }
.log { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.msg { max-width: 86%; padding: 10px 13px; border-radius: 16px; font-size: 14px; line-height: 1.5; animation: rise .35s ease both; white-space: pre-wrap; }
.msg.bot { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.msg.me { align-self: flex-end; background: var(--ink); color: var(--paper); border-bottom-right-radius: 5px; }
.msg.sys { align-self: center; background: none; color: var(--muted); font-size: 12.5px; text-align: center; }
.msg .price { background: linear-gradient(180deg, transparent 55%, var(--sand) 55%); font-weight: 700; padding: 0 2px; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.miniQuote { align-self: flex-start; width: 86%; padding: 12px 14px; border-radius: 14px; background: #fff; border: 1px dashed var(--accent); font-size: 12.5px; animation: rise .4s ease both; }
.miniQuote b { display: block; margin-bottom: 6px; font: 600 10.5px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--accent); }
.miniQuote div { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; color: var(--ink-2); }
.miniQuote div span:last-child { font-family: var(--mono); white-space: nowrap; }
.miniQuote .sum { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); font-weight: 800; color: var(--ink); }
.typing { align-self: flex-start; display: flex; gap: 4px; padding: 12px 14px; border-radius: 14px; background: #fff; border: 1px solid var(--line); }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: bounce 1s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 80%, 100% { opacity: .3; transform: none; } 40% { opacity: 1; transform: translateY(-3px); } }
.chips { display: flex; gap: 6px; padding: 8px 12px 0; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex-shrink: 0; padding: 7px 11px; border-radius: 99px; border: 1px solid var(--line); background: #fff; font-size: 12.5px; cursor: pointer; transition: border-color .2s, transform .2s; }
.chips button:hover { border-color: var(--accent); transform: translateY(-1px); }
.composer { display: flex; gap: 8px; padding: 10px 12px 12px; }
.composer input#input { flex: 1; min-width: 0; height: 46px; padding: 0 14px; border-radius: 13px; border: 1px solid rgba(17,18,20,.18); background: #fff; color: var(--ink); font-size: 14.5px; outline: none; }
.composer input#input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(154,123,79,.18); }
.send { width: 46px; border: 0; border-radius: 13px; background: var(--ink); color: var(--sand); font-size: 17px; cursor: pointer; }
.send:disabled { opacity: .4; cursor: default; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ---------- panel ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }
.kpi { position: relative; padding: 15px 16px; border-radius: var(--r); background: var(--night-2); border: 1px solid var(--nline); overflow: hidden; }
.kpi span { display: block; font: 600 10.5px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--nmuted); }
.kpi strong { display: block; margin: 8px 0 4px; font-size: clamp(1.35rem, 2vw, 1.85rem); letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--nmuted); font-size: 11.5px; }
.kpi.flash::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px var(--sand); background: radial-gradient(300px 120px at 50% 0%, rgba(217,200,165,.18), transparent 70%); animation: fade 1.4s ease forwards; }
@keyframes fade { from { opacity: 1; } to { opacity: 0; } }

.grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.card { min-width: 0; padding: 16px 16px 14px; border-radius: var(--r); background: var(--night-2); border: 1px solid var(--nline); }
.card header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card h2 { margin: 0; font-size: 14.5px; letter-spacing: -.01em; }
.hint { color: var(--nmuted); font-size: 11.5px; text-align: right; }
.note { margin: 8px 0 0; color: var(--nmuted); font-size: 11.5px; }
.note b { color: var(--sand); font-weight: 600; }
.chartCard { grid-column: span 4; }
.funnelCard { grid-column: span 2; }
.quoteCard { grid-column: span 3; }
.feedCard { grid-column: span 3; }
.leadCard { grid-column: span 2; }
.priceCard { grid-column: span 4; }

/* chart */
.chartWrap { position: relative; height: 190px; }
#chart { width: 100%; height: 100%; overflow: visible; }
.tip { position: absolute; pointer-events: none; transform: translate(-50%, -110%); padding: 6px 10px; border-radius: 9px; background: var(--paper); color: var(--ink); font-size: 12px; white-space: nowrap; box-shadow: 0 8px 20px rgba(0,0,0,.35); }
.tip b { font-variant-numeric: tabular-nums; }

/* funnel */
.funnel { display: grid; gap: 10px; }
.fRow { display: grid; grid-template-columns: 70px 1fr 34px; align-items: center; gap: 10px; font-size: 12.5px; color: var(--nmuted); }
.fRow b { color: var(--ntext); text-align: right; font-variant-numeric: tabular-nums; }
.fBar { height: 12px; border-radius: 99px; background: rgba(242,240,233,.06); overflow: hidden; }
.fBar i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--sand)); transition: width 1.1s cubic-bezier(.2,.8,.2,1); }
.speed { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--nline); }
.speed span { display: block; font: 600 10.5px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--nmuted); }
.speed strong { display: block; font-size: 24px; letter-spacing: -.03em; margin: 4px 0 2px; color: var(--sand); }
.speed small { color: var(--nmuted); font-size: 11.5px; }

/* feed */
.pulse { width: 8px; height: 8px; border-radius: 50%; background: rgba(242,240,233,.2); }
.pulse.on { background: var(--green); animation: ping 1.2s infinite; }
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.feed li { display: grid; grid-template-columns: 18px 1fr auto; gap: 8px; align-items: start; font-size: 12.5px; line-height: 1.4; color: #D9D6CE; animation: rise .3s ease both; }
.feed li.idle { display: block; color: var(--nmuted); }
.feed li .ic { width: 16px; height: 16px; margin-top: 1px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; background: rgba(217,200,165,.18); color: var(--sand); }
.feed li.wait .ic { border: 2px solid rgba(217,200,165,.25); border-top-color: var(--sand); background: none; animation: spin .8s linear infinite; }
.feed li em { font-style: normal; color: var(--nmuted); font: 500 10.5px/1.6 var(--mono); }
.feed li b { color: var(--ntext); font-weight: 600; }
@keyframes spin { to { transform: rotate(360deg); } }

/* quote */
.qEmpty, .leadEmpty p { color: var(--nmuted); font-size: 12.5px; margin: 0; }
.qLines { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.qLines li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 9px; border-radius: 9px; background: rgba(242,240,233,.035); font-size: 12.5px; animation: slideIn .4s cubic-bezier(.2,.8,.2,1) both; }
.qLines li span:first-child { flex: 1; color: #D9D6CE; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qLines li span:last-child { font: 500 12px/1.4 var(--mono); white-space: nowrap; font-variant-numeric: tabular-nums; }
.qLines li.changed span:last-child { color: var(--sand); }
@keyframes slideIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.qTotal { display: flex; justify-content: space-between; align-items: baseline; margin-top: 10px; padding: 10px 11px; border-radius: 11px; background: rgba(217,200,165,.12); }
.qTotal span { font: 600 10.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--sand); }
.qTotal strong { font-size: 19px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.qTotal.glow { animation: glow 1.6s ease; }
@keyframes glow { 0% { box-shadow: 0 0 0 0 rgba(217,200,165,.0); } 30% { box-shadow: 0 0 0 4px rgba(217,200,165,.35), 0 0 40px rgba(217,200,165,.25); } 100% { box-shadow: 0 0 0 0 rgba(217,200,165,0); } }
.qDays { margin-top: 10px; }
.qDays span { display: block; font-size: 11.5px; color: var(--nmuted); margin-bottom: 4px; }
#daysDots { width: 100%; height: 16px; display: block; }

/* lead */
.leadEmpty { display: grid; gap: 10px; }
#leadDots { width: 100%; height: 70px; display: block; }
.leadBody { animation: rise .45s ease both; }
.leadName { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.leadPhone { font: 600 14px/1.5 var(--mono); color: var(--sand); }
.leadSum { margin: 8px 0; font-size: 12.5px; color: #D9D6CE; }
.leadQuote { font: 500 12px/1.4 var(--mono); color: var(--nmuted); margin-bottom: 12px; }
.leadBtns { display: flex; gap: 8px; flex-wrap: wrap; }
.leadCard.new { animation: leadPulse 2s ease; }
@keyframes leadPulse { 0%, 100% { border-color: var(--nline); } 20% { border-color: var(--sand); box-shadow: 0 0 50px rgba(217,200,165,.2); } }

/* price editor */
.svcTabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.svcTabs button { padding: 6px 12px; border-radius: 99px; border: 1px solid var(--nline); background: transparent; color: var(--nmuted); font-size: 12.5px; cursor: pointer; }
.svcTabs button.active { background: rgba(217,200,165,.16); color: var(--ntext); border-color: rgba(217,200,165,.35); }
.prices { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 12px; }
.prices li { display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; background: rgba(242,240,233,.03); font-size: 12.5px; }
.prices li span:first-child { color: #D9D6CE; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prices li .val { font: 500 12px/1 var(--mono); min-width: 110px; text-align: right; font-variant-numeric: tabular-nums; }
.prices li.bump .val { color: var(--sand); }
.step { width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--nline); background: rgba(242,240,233,.05); color: var(--ntext); cursor: pointer; font-weight: 700; }
.step:hover { border-color: var(--sand); }

/* flying dots + toasts */
.fly { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 20; }
.toasts { position: fixed; bottom: 18px; right: 18px; z-index: 30; display: grid; gap: 8px; width: min(340px, calc(100vw - 32px)); }
.toast { display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding: 11px 13px; border-radius: 14px; background: #fff; color: var(--ink); box-shadow: 0 20px 50px rgba(0,0,0,.4); animation: toastIn .45s cubic-bezier(.2,.8,.2,1) both; }
.toast.out { animation: toastOut .4s ease forwards; }
.toast .tIcon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #2AABEE; color: #fff; font-size: 16px; }
.toast .tIcon.sand { background: var(--sand); color: var(--ink); }
.toast b { display: block; font-size: 12.5px; }
.toast small { display: block; font: 500 10.5px/1.3 var(--mono); color: var(--muted); margin-bottom: 2px; }
.toast p { margin: 0; font-size: 12.5px; color: var(--ink-2); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }

.tsBox { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(13,14,17,.7); }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .chartCard { grid-column: span 6; }
  .funnelCard, .feedCard, .quoteCard { grid-column: span 3; }
  .leadCard { grid-column: span 3; }
  .priceCard { grid-column: span 6; }
  .prices { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  body { overflow: auto; }
  .top { height: auto; flex-wrap: wrap; padding: 12px 16px; gap: 10px; }
  .topTitle { order: 3; flex-basis: 100%; }
  .topActions { margin-left: auto; }
  .topActions .light { display: none; }
  .tabs { display: flex; gap: 6px; position: sticky; top: 0; z-index: 6; padding: 8px 16px; background: var(--night); border-bottom: 1px solid var(--nline); }
  .tab { flex: 1; padding: 10px; border-radius: 12px; border: 1px solid var(--nline); background: transparent; color: var(--nmuted); font-weight: 700; cursor: pointer; }
  .tab.active { background: var(--paper); color: var(--ink); }
  .tabBadge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-left: 6px; padding: 0 5px; border-radius: 99px; background: var(--sand); color: var(--ink); font-size: 11px; }
  .stage { display: block; height: auto; }
  .client, .panel { overflow: visible; padding: 14px 16px 24px; }
  .stage[data-view="client"] .panel, .stage[data-view="panel"] .client { display: none; }
  .browser { height: calc(100dvh - 190px); min-height: 520px; }
  .grid { grid-template-columns: 1fr; }
  .chartCard, .funnelCard, .feedCard, .quoteCard, .leadCard, .priceCard { grid-column: auto; }
  .prices li .val { min-width: 92px; }
}
@media (max-width: 520px) {
  .kpi strong { font-size: 1.3rem; }
  .topActions .btn { padding: 8px 11px; font-size: 12px; }
  .siteNav span { display: none; }
}
.shot *, .shot *::before, .shot *::after { animation: none !important; transition: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
