/* Home page: the live pipeline. Leads arrive as channel events (a ringing phone, a WhatsApp
   message…) and AI-agent cursors move the cards along a CRM-style board on their own.
   Driven by pipeline.js. */
.pl-section {
    width: 100%;
    background: #f8fafc;
    padding: 4.5rem 1.5rem 5rem;
    display: flex;
    justify-content: center;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}
.pl-inner { width: 100%; max-width: 1180px; }

.pl-head { max-width: 46rem; margin: 0 auto 2rem; text-align: center; }
.pl-eyebrow { display: inline-flex; align-items: center; gap: 12px; font-size: .8rem; font-weight: 600; color: #00A896; }
.pl-eyebrow i { display: block; width: 34px; height: 1px; background: currentColor; }
.pl-title {
    margin: 16px 0 0;
    font-family: 'Inter Tight', 'Inter', system-ui, sans-serif;
    font-size: clamp(26px, min(4.3vw, 6.2vh), 46px);
    font-weight: 500;
    color: #0f172a;
    letter-spacing: -0.022em;
    line-height: 1.08;
    text-wrap: balance;
}
.pl-sub { margin: 14px auto 0; max-width: 36rem; font-size: 1.02rem; line-height: 1.6; color: #475569; }

/* ── the app window ── */
.pl-app {
    position: relative;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 30px 60px -40px rgba(15, 23, 42, .4), 0 1px 0 rgba(255, 255, 255, .8) inset;
    overflow: hidden;
    user-select: none;
    --card-h: 92px;
    --gap: 8px;
    --rows: 4;
}
.pl-bar {
    display: flex; align-items: center; gap: 14px;
    padding: 10px 14px;
    border-bottom: 1px solid #eef2f6;
    background: #fbfcfd;
}
.pl-dots { display: flex; gap: 6px; }
.pl-dots i { width: 10px; height: 10px; border-radius: 50%; background: #e2e8f0; }
.pl-dots i:nth-child(1) { background: #fca5a5; } .pl-dots i:nth-child(2) { background: #fcd34d; } .pl-dots i:nth-child(3) { background: #86efac; }
.pl-bar-title { font-size: .78rem; font-weight: 600; color: #0f172a; display: flex; align-items: center; gap: 8px; }
.pl-bar-title small { font-weight: 500; color: #94a3b8; }
.pl-attn { display: none; margin-left: auto; align-items: center; gap: 6px; font-size: .68rem; font-weight: 700; color: #92400e; background: #fef3c7; border: 1px solid #fde68a; padding: 3px 9px; border-radius: 999px; }
.pl-attn.is-on { display: inline-flex; }
.pl-attn::before { content: 'Needs attention'; font-weight: 600; }
.pl-attn.is-on + .pl-live { margin-left: 8px; }
.pl-live { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: .68rem; font-weight: 700; letter-spacing: .08em; color: #0f766e; background: #f0fdfa; border: 1px solid #ccfbf1; padding: 3px 9px; border-radius: 999px; }
.pl-live i { width: 6px; height: 6px; border-radius: 50%; background: #00A896; animation: pl-blink 1.4s ease-in-out infinite; }
@keyframes pl-blink { 50% { opacity: .3; } }
.pl-agents { display: flex; margin-left: 10px; }
.pl-agents span {
    width: 24px; height: 24px; border-radius: 50%; margin-left: -6px;
    border: 2px solid #fff; background: var(--ac); color: #fff;
    font-size: .6rem; font-weight: 700; display: grid; place-items: center;
}
.pl-agents span:first-child { margin-left: 0; }

/* the incoming-event strip: where leads come from */
.pl-inbox {
    position: relative;
    height: 64px;
    border-bottom: 1px solid #eef2f6;
    background: linear-gradient(180deg, #fbfcfd, #fff);
    overflow: hidden;
}
.pl-inbox-label { position: absolute; left: 14px; top: 50%; translate: 0 -50%; font-size: .66rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #94a3b8; }
.pl-event {
    position: absolute; top: 50%; left: var(--x, 50%);
    translate: -50% -50%;
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px 8px 8px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 24px -14px rgba(15, 23, 42, .45);
    font-size: .76rem; color: #0f172a; white-space: nowrap;
    animation: pl-event 2.4s cubic-bezier(.2, .8, .3, 1) forwards;
    pointer-events: none;
}
.pl-event b { font-weight: 600; }
.pl-event small { display: block; font-size: .64rem; color: #64748b; }
.pl-event i { position: relative; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #fff; background: var(--c); flex-shrink: 0; }
.pl-event i svg { width: 16px; height: 16px; }
@keyframes pl-event {
    0% { opacity: 0; transform: translateY(14px) scale(.9); }
    14%, 72% { opacity: 1; transform: none; }
    100% { opacity: 0; transform: translateY(26px) scale(.92); }
}
/* the phone rings, the bubble pops, the form types, the envelope wiggles */
.pl-event--call i svg { animation: pl-ring .5s ease-in-out 4; transform-origin: 50% 20%; }
@keyframes pl-ring { 0%, 100% { rotate: 0deg; } 25% { rotate: -16deg; } 75% { rotate: 16deg; } }
.pl-event--call i::after, .pl-event--wa i::after {
    content: ''; position: absolute; inset: -4px; border-radius: 12px;
    border: 2px solid var(--c); opacity: 0;
    animation: pl-pulse 1s ease-out 2;
}
@keyframes pl-pulse { 0% { opacity: .8; transform: scale(.9); } 100% { opacity: 0; transform: scale(1.5); } }
.pl-event--wa i svg { animation: pl-pop .5s cubic-bezier(.2, 1.4, .4, 1) 1; }
@keyframes pl-pop { from { transform: scale(.3); } }
.pl-event--web .pl-type { display: inline-block; min-width: 6ch; }
.pl-event--web .pl-type::after { content: '|'; animation: pl-caret .8s steps(1) infinite; color: #6366f1; }
@keyframes pl-caret { 50% { opacity: 0; } }
.pl-event--email i svg { animation: pl-wiggle .7s ease-in-out 2; }
@keyframes pl-wiggle { 0%, 100% { rotate: 0deg; } 30% { rotate: -8deg; } 60% { rotate: 8deg; } }
.pl-event .pl-badge { position: absolute; right: -4px; top: -4px; width: 14px; height: 14px; border-radius: 50%; background: #ef4444; color: #fff; font-size: .55rem; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }

/* ── the board ── */
.pl-board { position: relative; padding: 14px; }
.pl-stages { position: relative; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; min-width: 0; }
.pl-stage { position: relative; min-width: 0; border-radius: 12px; background: #f8fafc; border: 1px solid #eef2f6; padding: 10px 8px 8px; }
.pl-stage::before { content: ''; position: absolute; left: 10px; right: 10px; top: 0; height: 3px; border-radius: 0 0 3px 3px; background: var(--sc, #cbd5e1); }
.pl-stage h3 { margin: 4px 0 0; font-size: .72rem; font-weight: 700; color: #0f172a; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.pl-stage h3 b { margin-left: auto; font-weight: 600; font-size: .64rem; color: #64748b; background: #fff; border: 1px solid #e2e8f0; border-radius: 999px; padding: 1px 7px; min-width: 22px; text-align: center; }
.pl-stage p { margin: 2px 0 10px; font-size: .64rem; font-weight: 600; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.pl-slots { height: calc(var(--rows) * (var(--card-h) + var(--gap)) - var(--gap)); border-radius: 8px; }
.pl-stage--won { background: #f0fdf9; border-color: #ccfbf1; }
.pl-stage--won .pl-slots { background: repeating-linear-gradient(135deg, transparent 0 8px, rgba(0, 168, 150, .04) 8px 16px); }

/* lost lane */
.pl-lost {
    margin-top: 10px;
    display: flex; align-items: center; gap: 10px;
    min-height: 44px; padding: 6px 10px;
    border-radius: 10px;
    background: #fff7f7; border: 1px dashed #fecaca;
}
.pl-lost h3 { margin: 0; font-size: .7rem; font-weight: 700; color: #b91c1c; display: flex; align-items: center; gap: 6px; }
.pl-lost h3 b { font-weight: 600; font-size: .62rem; color: #b91c1c; background: #fee2e2; border-radius: 999px; padding: 1px 7px; }
.pl-lost-row { position: relative; flex: 1; height: 32px; }

/* lead cards: positioned by the script, moved with transforms */
.pl-layer { position: absolute; inset: 0; pointer-events: none; }
.pl-card {
    position: absolute; left: 0; top: 0;
    width: var(--w, 160px); max-width: var(--w, 160px); height: var(--card-h);
    box-sizing: border-box;
    padding: 8px 9px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
    display: flex; flex-direction: column; justify-content: space-between;
    font-size: .72rem;
    will-change: transform;
    transition: transform .85s cubic-bezier(.3, .9, .3, 1), box-shadow .3s, opacity .4s, height .4s, padding .4s;
}
.pl-card.is-new { animation: pl-in .55s cubic-bezier(.2, .9, .3, 1.15); }
@keyframes pl-in { from { opacity: 0; transform: translate(var(--x0), var(--y0)) scale(.6); } }
.pl-card.is-lift { box-shadow: 0 18px 30px -14px rgba(15, 23, 42, .5); z-index: 5; rotate: -1.5deg; }
.pl-card.is-new { z-index: 4; }
.pl-card.is-lift::after { content: ''; position: absolute; inset: -1px; border-radius: inherit; border: 1.5px solid var(--ac, #00A896); }
.pl-card.is-out { opacity: 0; transform: translate(var(--x), var(--y)) scale(.9); }
.pl-row1 { display: flex; align-items: center; gap: 7px; min-width: 0; }
.pl-row1 .pl-val { margin-left: auto; }
.pl-act { display: flex; flex-direction: column; gap: 1px; min-width: 0; margin: 3px 0 2px; }
.pl-act em { font-style: normal; font-size: .6rem; line-height: 1.3; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 9px; position: relative; }
.pl-act em::before { content: ''; position: absolute; left: 0; top: .42em; width: 4px; height: 4px; border-radius: 50%; background: #cbd5e1; }
.pl-act em:last-child { color: #0f172a; }
.pl-act em:last-child::before { background: #00A896; }
.pl-act em.is-fresh { animation: pl-fresh .9s ease; }
@keyframes pl-fresh { 0% { background: #ccfbf1; } 100% { background: transparent; } }
.pl-flag { display: none; margin-left: auto; padding: 1px 6px; border-radius: 5px; font-size: .56rem; font-weight: 700; color: #92400e; background: #fef3c7; white-space: nowrap; }
.pl-card.is-attn { border-color: #fcd34d; box-shadow: 0 0 0 3px rgba(251, 191, 36, .25); animation: pl-attn 1.2s ease-in-out infinite; }
.pl-card.is-attn .pl-flag { display: inline-block; }
@keyframes pl-attn { 50% { box-shadow: 0 0 0 6px rgba(251, 191, 36, .12); } }
.pl-card.is-human { border-color: #a5b4fc; }
.pl-card.is-human .pl-flag { display: inline-block; background: #e0e7ff; color: #3730a3; }
.pl-av { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .58rem; background: var(--av); }
.pl-card b { display: block; min-width: 0; font-weight: 600; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-row2 { display: flex; align-items: center; gap: 5px; min-width: 0; }
.pl-tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px; border-radius: 5px; font-size: .6rem; font-weight: 600; color: #475569; background: #f1f5f9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-tag i { width: 5px; height: 5px; border-radius: 50%; background: var(--c); flex-shrink: 0; }
.pl-val { margin-left: auto; font-size: .62rem; font-weight: 700; color: #0f172a; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pl-card.is-won { border-color: #99f6e4; background: #f0fdfa; }
.pl-card.is-won .pl-val { color: #0f766e; }
.pl-card.is-won .pl-val::before { content: '\2713 '; }
/* a lost card collapses into a chip in the lost lane */
.pl-card.is-lost { height: 32px; padding: 0 10px; justify-content: center; background: #fff; border-color: #fecaca; }
.pl-card.is-lost .pl-row2, .pl-card.is-lost .pl-av, .pl-card.is-lost .pl-act, .pl-card.is-lost .pl-val { display: none; }
.pl-card.is-lost b { font-size: .68rem; color: #991b1b; }
.pl-card.is-lost b::after { content: attr(data-why); font-weight: 500; color: #b91c1c; opacity: .8; }

/* the agent cursors */
.pl-cursor {
    position: absolute; left: 0; top: 0; z-index: 6;
    pointer-events: none;
    transition: transform .85s cubic-bezier(.3, .9, .3, 1), opacity .3s;
    opacity: 0;
}
.pl-cursor.is-on { opacity: 1; }
.pl-cursor svg { width: 17px; height: 17px; display: block; filter: drop-shadow(0 2px 3px rgba(15, 23, 42, .3)); transition: transform .15s; }
.pl-cursor span {
    position: absolute; left: 14px; top: 15px;
    padding: 3px 8px; border-radius: 6px;
    background: var(--ac); color: #fff;
    font-size: .6rem; font-weight: 700; white-space: nowrap;
    box-shadow: 0 4px 10px -4px color-mix(in srgb, var(--ac) 70%, transparent);
}
.pl-cursor.is-press svg { transform: scale(.82); }

/* ticker + stats */
.pl-log {
    margin: 0; padding: 10px 14px;
    border-top: 1px solid #eef2f6;
    background: #fbfcfd;
    display: flex; align-items: center; gap: 10px;
    font-size: .76rem; color: #475569;
    min-height: 2.4em;
}
.pl-log i { width: 7px; height: 7px; border-radius: 50%; background: #00A896; animation: pl-blink 1.4s ease-in-out infinite; flex-shrink: 0; }
.pl-log b { color: #0f172a; font-weight: 600; }
.pl-log span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pl-stats { display: flex; flex-wrap: wrap; gap: 14px 36px; margin-top: 22px; justify-content: center; }
.pl-stat { text-align: center; }
.pl-stat b { display: block; font-family: 'Inter Tight', 'Inter', sans-serif; font-size: 1.6rem; font-weight: 500; letter-spacing: -0.02em; color: #0f172a; font-variant-numeric: tabular-nums; }
.pl-stat span { font-size: .78rem; color: #64748b; }

@media (max-width: 1000px) {
    .pl-app { --card-h: 86px; }
    .pl-stage { padding: 8px 6px 6px; }
    .pl-stage h3 { font-size: .66rem; }
    .pl-stage p { font-size: .6rem; }
    .pl-card { padding: 6px 7px; }
    .pl-av { width: 20px; height: 20px; }
    .pl-tag { font-size: .56rem; padding: 1px 5px; }
}
@media (max-width: 640px) {
    .pl-section { padding: 3rem 1.25rem 3.5rem; }
    .pl-stages { grid-template-columns: repeat(6, 150px); overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
    .pl-stages::-webkit-scrollbar { display: none; }
    .pl-board { padding: 10px; }
    .pl-bar-title small, .pl-inbox-label { display: none; }
    .pl-lost-row { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) {
    .pl-card, .pl-cursor { transition: none; }
    .pl-card.is-new, .pl-log i, .pl-live i, .pl-event, .pl-event i svg, .pl-event i::after { animation: none; }
    .pl-event { opacity: 1; }
}
