:root {
  --bg: #09090b; --surface: #131316; --surface2: #1b1b20; --line: #2a2a31;
  --text: #f2f2ee; --grey: #9a9aa3; --acid: #c9ff1f; --ink: #0b0b0c;
  --hot: #ff5a3c; --warm: #ffb020; --cold: #5aa9ff; --wa: #25d366;
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button { font: inherit; cursor: pointer; }
.app { display: flex; flex-direction: column; height: 100%; padding: 14px; gap: 12px; }
.tabs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; flex-shrink: 0; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex-shrink: 0; border: 1px solid var(--line); background: var(--surface); color: var(--grey); border-radius: 999px; padding: 9px 16px; font: 700 12px/1 ui-monospace, Consolas, monospace; letter-spacing: .04em; text-transform: uppercase; transition: .25s; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: var(--acid); border-color: var(--acid); color: var(--ink); }
.stage { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: 12px; }
.board-wrap, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; min-height: 0; }
.board-wrap { display: flex; flex-direction: column; padding: 14px 14px 10px; background-image: radial-gradient(circle, #ffffff10 1px, transparent 1.2px); background-size: 22px 22px; }
.board-head { display: flex; justify-content: space-between; align-items: center; }
.live { display: inline-flex; align-items: center; gap: 8px; font: 700 11px ui-monospace, Consolas, monospace; text-transform: uppercase; letter-spacing: .06em; color: var(--acid); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--acid); box-shadow: 0 0 0 0 #c9ff1f80; animation: ping 1.6s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 8px #c9ff1f00; } 100% { box-shadow: 0 0 0 0 #c9ff1f00; } }
.run { border: 1px solid var(--line); background: var(--surface2); color: var(--text); border-radius: 999px; padding: 7px 14px; font-size: 12px; font-weight: 700; }
.run:hover { border-color: var(--acid); color: var(--acid); }
.board { flex: 1; min-height: 0; width: 100%; }
.log { min-height: 1.5em; font: 12px ui-monospace, Consolas, monospace; color: var(--grey); }
.log b { color: var(--acid); font-weight: 700; }
.foot { text-align: center; font-size: 12px; color: var(--grey); flex-shrink: 0; }

/* nodes */
.edge { fill: none; stroke: var(--line); stroke-width: 2; transition: stroke .3s; }
.edge.on { stroke: #c9ff1f66; }
.pulse { fill: var(--acid); filter: drop-shadow(0 0 6px var(--acid)); }
.node rect { fill: var(--surface2); stroke: var(--line); stroke-width: 1.5; transition: fill .3s, stroke .3s; }
.node .ic { font-size: 20px; }
.node .t { fill: var(--text); font: 700 13px system-ui, sans-serif; }
.node .s { fill: var(--grey); font: 11px ui-monospace, Consolas, monospace; }
.node.active rect { stroke: var(--acid); fill: #1f2410; }
.node.done rect { stroke: #c9ff1f80; }
.node .ok { fill: var(--acid); font: 700 12px system-ui; opacity: 0; transition: opacity .3s; }
.node.done .ok { opacity: 1; }

/* panel */
.panel { display: flex; flex-direction: column; overflow: hidden; }
.p-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.p-head .av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--acid); color: var(--ink); font-weight: 800; flex-shrink: 0; }
.p-head b { display: block; font-size: 14px; }
.p-head small { color: var(--grey); font-size: 12px; }
.p-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; scroll-behavior: smooth; }
.chat { background: #0d1418; background-image: radial-gradient(circle, #ffffff08 1px, transparent 1.2px); background-size: 18px 18px; }
.msg { max-width: 82%; padding: 8px 11px; border-radius: 12px; font-size: 14px; animation: pop .3s ease-out both; white-space: pre-line; }
.msg.in { align-self: flex-start; background: #1f2c33; border-top-left-radius: 4px; }
.msg.out { align-self: flex-end; background: #144d37; border-top-right-radius: 4px; }
.msg small { display: block; text-align: right; color: #ffffff70; font-size: 10px; margin-top: 3px; }
.sys { align-self: center; font: 11px ui-monospace, Consolas, monospace; color: var(--grey); background: #ffffff0d; padding: 4px 10px; border-radius: 999px; animation: pop .3s both; }
.typing { align-self: flex-start; background: #1f2c33; padding: 10px 14px; border-radius: 12px; display: flex; gap: 4px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--grey); animation: bl 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bl { 50% { opacity: .2; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }
.compose { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); background: var(--surface); }
.compose input { flex: 1; min-width: 0; background: var(--surface2); border: 1px solid var(--line); color: var(--text); border-radius: 999px; padding: 10px 14px; font: inherit; outline: none; }
.compose input:focus { border-color: var(--acid); }
.compose button { background: var(--wa); color: #fff; border: 0; border-radius: 999px; padding: 0 16px; font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 10px 10px; background: var(--surface); }
.chips button { border: 1px solid var(--line); background: transparent; color: var(--grey); border-radius: 999px; padding: 5px 10px; font-size: 12px; }
.chips button:hover { color: var(--acid); border-color: var(--acid); }

/* lead table */
.leads { width: 100%; border-collapse: collapse; font-size: 13px; }
.leads th { text-align: left; color: var(--grey); font: 700 10px ui-monospace, Consolas, monospace; text-transform: uppercase; letter-spacing: .05em; padding: 6px 6px; border-bottom: 1px solid var(--line); }
.leads td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.leads tr { animation: pop .3s both; transition: transform .5s; }
.leads td small { display: block; color: var(--grey); font-size: 11px; }
.score { font: 700 13px ui-monospace, Consolas, monospace; }
.tag { display: inline-block; border-radius: 999px; padding: 2px 8px; font: 700 10px ui-monospace, Consolas, monospace; text-transform: uppercase; }
.tag.hot { background: #ff5a3c22; color: var(--hot); } .tag.warm { background: #ffb02022; color: var(--warm); } .tag.cold { background: #5aa9ff22; color: var(--cold); }
.sent { color: var(--acid); font-size: 11px; font-weight: 700; }

/* inbox */
.mail { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface2); animation: pop .3s both; }
.mail b { font-size: 13px; } .mail p { color: var(--grey); font-size: 12.5px; margin-top: 2px; }
.mail .row { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.mail .tag.sales { background: #c9ff1f22; color: var(--acid); } .mail .tag.support { background: #5aa9ff22; color: var(--cold); } .mail .tag.spam { background: #ffffff14; color: var(--grey); }
.mail.spam { opacity: .45; }
.draft { margin-top: 8px; border-left: 2px solid var(--acid); padding: 6px 10px; font-size: 12.5px; color: var(--text); background: #c9ff1f0d; border-radius: 0 8px 8px 0; animation: pop .3s both; }
.card { border: 1px solid var(--acid); border-radius: 14px; padding: 12px; background: #c9ff1f0d; animation: pop .3s both; font-size: 13px; }
.card h4 { font-size: 13px; color: var(--acid); margin-bottom: 6px; font-family: ui-monospace, Consolas, monospace; text-transform: uppercase; letter-spacing: .05em; }
.card dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; } .card dt { color: var(--grey); } .card dd { margin: 0; }

@media (max-width: 760px) {
  .app { padding: 10px; gap: 10px; }
  .stage { grid-template-columns: 1fr; grid-template-rows: minmax(300px, 1fr) minmax(330px, 1fr); }
  .msg { font-size: 13.5px; }
}

/* receptionist call */
.snd { margin-left: auto; border: 1px solid var(--line); background: var(--surface2); color: var(--text); border-radius: 999px; padding: 7px 12px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.snd:hover { border-color: var(--acid); color: var(--acid); }
.call { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #0d1418; }
.call .clock { font: 700 13px ui-monospace, Consolas, monospace; color: var(--acid); }
.wave { display: flex; align-items: center; gap: 3px; height: 30px; flex: 1; }
.wave.caller { justify-content: flex-end; }
.wave i { width: 3px; height: 4px; border-radius: 2px; background: #ffffff30; transition: background .3s; }
.call[data-talk="ai"] .wave.ai i, .call[data-talk="caller"] .wave.caller i { animation: wv .8s ease-in-out infinite; }
.call[data-talk="ai"] .wave.ai i { background: var(--acid); }
.call[data-talk="caller"] .wave.caller i { background: var(--cold); }
.wave i:nth-child(3n) { animation-delay: -.2s !important; } .wave i:nth-child(3n+1) { animation-delay: -.45s !important; } .wave i:nth-child(4n) { animation-delay: -.65s !important; }
@keyframes wv { 0%, 100% { height: 4px; } 50% { height: 26px; } }
.msg .who { display: block; font: 700 10px ui-monospace, Consolas, monospace; text-transform: uppercase; letter-spacing: .05em; color: #ffffff80; margin-bottom: 2px; }

/* before / after card (AI receptionist) */
.ba { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; animation: pop .3s both; }
.ba > div { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; background: var(--surface2); }
.ba .good { border-color: #c9ff1f80; background: #c9ff1f0d; }
.ba h4 { font: 700 10px ui-monospace, Consolas, monospace; text-transform: uppercase; letter-spacing: .05em; color: var(--grey); margin-bottom: 6px; }
.ba .good h4 { color: var(--acid); }
.ba ol { list-style: none; padding: 0; display: grid; gap: 5px; font-size: 12.5px; }
.ba li { opacity: 0; transform: translateY(4px); transition: opacity .3s, transform .3s; padding-left: 16px; position: relative; }
.ba li.on { opacity: 1; transform: none; }
.ba li::before { position: absolute; left: 0; font-size: 11px; }
.ba .bad li::before { content: "✕"; color: var(--grey); }
.ba .good li::before { content: "✓"; color: var(--acid); }
.ba .bad li:last-child { color: var(--grey); text-decoration: line-through; }
@media (max-width: 420px) { .ba { grid-template-columns: 1fr; } }

/* phone: show that the tabs scroll and can be tapped */
.tabs-wrap { position: relative; flex-shrink: 0; }
.tap-hint { display: none; }
@media (max-width: 760px) {
  .tabs-wrap::after { content: ""; position: absolute; right: 0; top: 0; height: 34px; width: 48px; background: linear-gradient(90deg, transparent, var(--bg)); pointer-events: none; transition: opacity .3s; }
  .tabs-wrap.end::after { opacity: 0; }
  .tap-hint { display: block; margin-top: 8px; font: 700 11px ui-monospace, Consolas, monospace; color: var(--acid); letter-spacing: .03em; animation: nudge 1.4s ease-in-out infinite; }
  body.tapped .tap-hint { display: none; }
  body:not(.tapped) .tab:not([aria-selected="true"]) { animation: glow 1.8s ease-in-out infinite; }
}
@keyframes nudge { 50% { transform: translateX(6px); } }
@keyframes glow { 50% { border-color: #c9ff1f99; color: var(--text); } }
