/* ─── Hub login / logged-out showcase ──────────────────────────────────────
   Dark stage + light "product window" (mirrors the real light dashboard).
   Final states are the natural CSS — GSAP (login.js) only animates *from*,
   so if the CDN fails or motion is reduced, everything still renders. */
#auth-overlay {
    position: fixed; inset: 0; z-index: 1000; display: flex; overflow-x: hidden; overflow-y: auto;
    --ink: #070b14; --l-text: #e5e7eb; --l-mut: #94a3b8; --l-line: rgba(255,255,255,.09);
    --red: #D31719; --red2: #ff4d4f; --good: #059669; --mx: 70%; --my: 30%;
    background:
        radial-gradient(700px 520px at var(--mx) var(--my), rgba(211,23,25,.22), transparent 62%),
        radial-gradient(900px 600px at 0% 110%, rgba(59,130,246,.12), transparent 60%),
        var(--ink);
    color: var(--l-text); font-family: 'Outfit', system-ui, -apple-system, sans-serif;
}
/* Isolation: the hub's main.css styles bare elements (e.g. the dashboard's
   sticky `header` bar). Reset anything structural inside the overlay so
   global hub rules can never leak into this screen. */
#auth-overlay :is(header, footer, aside) { position: static; height: auto; min-height: 0; padding: 0; background: none; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none; }
#login-bg { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
#auth-overlay::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
    background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
    background-size: 44px 44px; mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 75%); -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 75%); }

/* Boot mark — the only thing visible until showLogin() confirms we're logged out,
   so signed-in users never see the showcase flash. */
.login-boot { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 3; transition: opacity .4s; }
.login-boot .lmark { width: 56px; height: 56px; font-size: 1.6rem; animation: lbreathe 1.6s ease-in-out infinite; }
#auth-overlay.login-ready .login-boot { display: none; }
.login-shell { position: relative; z-index: 2; width: 100%; max-width: 1320px; margin: auto; padding: 1.6rem 2rem 1.4rem;
    display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(340px, 420px); grid-template-areas: "intro card" "show card" "foot foot";
    column-gap: 3.2rem; row-gap: 1.4rem; align-items: start; opacity: 0; visibility: hidden; }
#auth-overlay.login-ready .login-shell { opacity: 1; visibility: visible; }

.lmark { width: 40px; height: 40px; border-radius: 12px; background: var(--red); color: #fff; font-weight: 800; font-size: 1.25rem;
    display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 22px rgba(211,23,25,.45); flex-shrink: 0; }
.l-intro { grid-area: intro; }
.l-brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; color: #fff; font-weight: 700; font-size: 1.1rem; }
.l-brand b { color: var(--red2); font-weight: 700; }
.l-brand small { margin-left: .35rem; font-size: .66rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--l-mut);
    border: 1px solid var(--l-line); border-radius: 999px; padding: .2rem .55rem; }
.l-eyebrow { display: inline-flex; align-items: center; gap: .5rem; margin-top: 1.5rem; font-size: .72rem; font-weight: 700; letter-spacing: .12em;
    text-transform: uppercase; color: #fca5a5; background: rgba(211,23,25,.12); border: 1px solid rgba(252,165,165,.22); padding: .38rem .85rem; border-radius: 999px; }
.l-eyebrow i { width: 7px; height: 7px; border-radius: 50%; background: #f87171; animation: lping 2s infinite; }
.l-h1 { font-size: clamp(2rem, 4vw, 3.3rem); line-height: 1.04; letter-spacing: -.035em; font-weight: 800; margin: .9rem 0 0; color: #fff; }
.l-h1 .ln { display: block; overflow: hidden; padding-bottom: .06em; }
.l-h1 .ln > span { display: inline-block; }
.l-grad { background: linear-gradient(92deg, #fff 0%, #fca5a5 45%, var(--red2) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.l-sub { max-width: 40rem; margin-top: .9rem; font-size: 1.02rem; line-height: 1.6; color: #cbd5e1; font-weight: 400; }

/* Pillar tabs */
.l-show { grid-area: show; min-width: 0; }
.l-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; margin-bottom: 1.1rem; }
.l-tab { position: relative; display: flex; flex-direction: column; justify-content: flex-start; text-align: left; cursor: pointer; font: inherit; color: var(--l-mut); background: rgba(255,255,255,.03);
    border: 1px solid var(--l-line); border-radius: 14px; padding: .8rem .85rem .9rem; overflow: hidden; transition: color .25s, border-color .25s, background .25s, transform .25s; }
.l-tab:hover { color: #e2e8f0; transform: translateY(-2px); border-color: rgba(255,255,255,.18); }
.l-tab:focus-visible { outline: 2px solid var(--red2); outline-offset: 2px; }
.l-tab .n { display: block; font-size: .66rem; font-weight: 800; letter-spacing: .12em; color: rgba(255,255,255,.35); }
.l-tab b { display: block; margin-top: .15rem; font-size: .95rem; font-weight: 700; color: inherit; }
.l-tab span.d { display: block; margin-top: .15rem; font-size: .76rem; line-height: 1.35; }
.l-tab .bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; transform-origin: left; transform: scaleX(0); background: linear-gradient(90deg, var(--red), var(--red2)); }
.l-tab.on { color: #fff; background: rgba(211,23,25,.1); border-color: rgba(252,165,165,.35); }
.l-tab.on .n { color: #fca5a5; }

/* Product window */
.l-stage { perspective: 1400px; }
.l-win { position: relative; background: #f9fafb; color: #111827; border-radius: 18px; overflow: hidden; transform-style: preserve-3d;
    box-shadow: 0 40px 90px -20px rgba(0,0,0,.65), 0 0 0 1px rgba(255,255,255,.08), 0 0 80px rgba(211,23,25,.12); transition: transform .5s cubic-bezier(.2,.8,.2,1); will-change: transform; }
.l-chrome { display: flex; align-items: center; gap: .7rem; padding: .65rem .9rem; background: #fff; border-bottom: 1px solid #eef0f3; }
.l-dots { display: flex; gap: 6px; } .l-dots i { width: 10px; height: 10px; border-radius: 50%; background: #e5e7eb; } .l-dots i:first-child { background: #fca5a5; }
.l-url { flex: 1; min-width: 0; font-size: .74rem; color: #6b7280; background: #f3f4f6; border-radius: 8px; padding: .3rem .7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.l-url b { color: #111827; font-weight: 600; }
.l-sample { font-size: .62rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; border-radius: 6px; padding: .18rem .45rem; white-space: nowrap; }
.l-body { display: grid; grid-template-columns: 150px 1fr; height: 350px; }
.l-side { background: #fff; border-right: 1px solid #eef0f3; padding: .9rem .7rem; display: flex; flex-direction: column; gap: .25rem; font-size: .76rem; }
.l-side .cl { display: flex; align-items: center; gap: .45rem; font-weight: 700; font-size: .78rem; margin-bottom: .7rem; }
.l-side .cl i { width: 22px; height: 22px; border-radius: 7px; background: linear-gradient(135deg, #111827, #374151); }
.l-side a { display: flex; align-items: center; gap: .45rem; padding: .38rem .5rem; border-radius: 8px; color: #6b7280; text-decoration: none; transition: background .3s, color .3s; }
.l-side a.on { background: rgba(211,23,25,.08); color: var(--red); font-weight: 600; }
.l-side .lbl { margin: .55rem 0 .15rem .5rem; font-size: .58rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: #9ca3af; }
.l-main { position: relative; overflow: hidden; }
.l-scene { position: absolute; inset: 0; padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .8rem; opacity: 0; visibility: hidden; transition: opacity .45s, visibility .45s; }
.l-scene.on { opacity: 1; visibility: visible; }
.l-scene h4 { margin: 0; font-size: .92rem; font-weight: 700; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.l-scene h4 small { font-size: .68rem; font-weight: 600; color: #6b7280; background: #fff; border: 1px solid #eef0f3; border-radius: 999px; padding: .15rem .55rem; }
.l-card { background: #fff; border: 1px solid #eef0f3; border-radius: 12px; padding: .7rem .8rem; box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 6px 16px rgba(15,23,42,.05); }

/* Scene 1 — KPIs + chart */
.l-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; }
.l-kpi .k { font-size: .62rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #9ca3af; }
.l-kpi .v { font-size: 1.28rem; font-weight: 800; letter-spacing: -.02em; margin-top: .1rem; white-space: nowrap; }
.l-kpi .dl { display: inline-block; margin-top: .25rem; font-size: .64rem; font-weight: 700; padding: .05rem .4rem; border-radius: 999px; background: #ecfdf5; color: var(--good); }
.l-chart { flex: 1; position: relative; min-height: 0; }
.l-chart svg { position: absolute; inset: .7rem .8rem .5rem; width: calc(100% - 1.6rem); height: calc(100% - 1.2rem); overflow: visible; }
.l-chart .lab { position: absolute; top: .55rem; left: .8rem; font-size: .7rem; font-weight: 700; color: #374151; }
.l-pin { position: absolute; font-size: .6rem; font-weight: 700; color: #fff; background: #3b82f6; border-radius: 6px; padding: .12rem .4rem; transform: translate(-50%, -130%); white-space: nowrap; box-shadow: 0 4px 10px rgba(59,130,246,.35); }
.l-pin:after { content: ""; position: absolute; left: 50%; bottom: -4px; width: 7px; height: 7px; background: #3b82f6; transform: translateX(-50%) rotate(45deg); }

/* Scene 2 — understand */
.l-grid2 { display: grid; grid-template-columns: 1fr 1.25fr; gap: .7rem; flex: 1; min-height: 0; }
.l-donut { display: flex; align-items: center; gap: .9rem; }
.l-donut svg { width: 104px; height: 104px; transform: rotate(-90deg); flex-shrink: 0; }
.l-legend { display: flex; flex-direction: column; gap: .35rem; font-size: .72rem; }
.l-legend span { display: flex; align-items: center; gap: .4rem; } .l-legend i { width: 9px; height: 9px; border-radius: 3px; } .l-legend b { margin-left: auto; padding-left: .6rem; }
.l-bars { display: flex; align-items: flex-end; gap: .45rem; height: 112px; padding-top: .6rem; }
.l-bars div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .3rem; height: 100%; justify-content: flex-end; font-size: .6rem; color: #9ca3af; font-weight: 600; }
.l-bars i { display: block; width: 100%; border-radius: 6px 6px 3px 3px; background: #e5e7eb; transform-origin: bottom; }
.l-bars .hi i { background: linear-gradient(180deg, var(--red2), var(--red)); }
.l-bars .hi { color: var(--red); }
.l-insight { display: flex; gap: .7rem; align-items: flex-start; background: linear-gradient(135deg, #0b1220, #1e293b); color: #e2e8f0; border: none; }
.l-insight .ic { width: 30px; height: 30px; border-radius: 9px; background: rgba(211,23,25,.25); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: .9rem; }
.l-insight p { margin: 0; font-size: .8rem; line-height: 1.45; } .l-insight b { color: #fff; }

/* Scene 3 — Ask AI */
.l-chat { flex: 1; display: flex; flex-direction: column; gap: .6rem; min-height: 0; justify-content: flex-end; }
.l-msg { max-width: 84%; font-size: .8rem; line-height: 1.5; padding: .6rem .8rem; border-radius: 14px; }
.l-msg.me { align-self: flex-end; background: #111827; color: #fff; border-bottom-right-radius: 4px; }
.l-msg.ai { align-self: flex-start; background: #fff; border: 1px solid #eef0f3; border-bottom-left-radius: 4px; box-shadow: 0 6px 16px rgba(15,23,42,.05); }
.l-msg.ai .who { display: flex; align-items: center; gap: .35rem; font-size: .66rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--red); margin-bottom: .25rem; }
.typing::after { content: ""; display: inline-block; width: 2px; height: 1em; margin-left: 2px; vertical-align: -2px; background: currentColor; animation: lblink 1s steps(1) infinite; }
#l-dots { display: none; }
.l-typing { display: inline-flex; gap: 4px; } .l-typing i { width: 6px; height: 6px; border-radius: 50%; background: #cbd5e1; animation: ldot 1.2s infinite; } .l-typing i:nth-child(2) { animation-delay: .15s; } .l-typing i:nth-child(3) { animation-delay: .3s; }
.l-mini { display: flex; flex-direction: column; gap: .3rem; margin-top: .5rem; }
.l-mini div { display: grid; grid-template-columns: 92px 1fr 34px; align-items: center; gap: .45rem; font-size: .68rem; color: #6b7280; }
.l-mini s { text-decoration: none; display: block; height: 7px; border-radius: 99px; background: #e5e7eb; overflow: hidden; } .l-mini s i { display: block; height: 100%; border-radius: 99px; background: var(--red); transform-origin: left; }
.l-input { display: flex; align-items: center; gap: .5rem; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: .45rem .5rem .45rem .8rem; font-size: .76rem; color: #9ca3af; }
.l-input span { flex: 1; } .l-input em { font-style: normal; font-size: .7rem; font-weight: 700; color: #fff; background: var(--red); border-radius: 8px; padding: .3rem .6rem; }

/* Scene 4 — Communication */
.l-feed { display: flex; flex-direction: column; gap: .55rem; flex: 1; min-height: 0; }
.l-item { display: flex; align-items: center; gap: .7rem; }
.l-item .ic { width: 32px; height: 32px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: .95rem; background: #f3f4f6; }
.l-item .tx { flex: 1; min-width: 0; font-size: .78rem; } .l-item .tx b { display: block; font-size: .8rem; } .l-item .tx span { color: #6b7280; font-size: .7rem; }
.l-chip { font-size: .62rem; font-weight: 800; padding: .15rem .5rem; border-radius: 999px; white-space: nowrap; }
.l-chip.g { background: #ecfdf5; color: var(--good); } .l-chip.r { background: #fff1f1; color: var(--red); } .l-chip.b { background: #eff6ff; color: #2563eb; }
.l-bryan { display: flex; gap: .7rem; align-items: flex-start; border-left: 3px solid var(--red); }
.l-av { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--red), #7f1d1d); position: relative; }
.l-av:after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; background: #22c55e; border: 2px solid #fff; }
.l-bryan p { margin: .15rem 0 0; font-size: .78rem; line-height: 1.45; color: #374151; } .l-bryan .nm { font-size: .74rem; font-weight: 800; } .l-bryan .nm span { font-weight: 500; color: #9ca3af; margin-left: .3rem; }

/* Login card */
.l-card-wrap { grid-area: card; position: sticky; top: 2rem; align-self: start; margin-top: 4.2rem; }
.l-login { position: relative; padding: 2.1rem 1.9rem 1.6rem; border-radius: 24px; background: linear-gradient(180deg, rgba(255,255,255,.075), rgba(255,255,255,.03));
    border: 1px solid rgba(255,255,255,.1); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: 0 30px 80px -24px rgba(0,0,0,.7); overflow: hidden; }
.l-login:before { content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
    background: conic-gradient(from var(--ang, 0deg), transparent 0 70%, rgba(255,77,79,.85) 82%, transparent 94%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; animation: lspin 6s linear infinite; }
@property --ang { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.l-lock { width: 52px; height: 52px; border-radius: 16px; display: flex; align-items: center; justify-content: center; background: rgba(211,23,25,.14); border: 1px solid rgba(252,165,165,.25); color: #fca5a5; }
.l-lock svg { width: 24px; height: 24px; }
.l-login h2 { margin: 1.2rem 0 0; font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; color: #fff; }
#auth-msg { margin: .45rem 0 1.5rem; color: var(--l-mut); font-size: .95rem; line-height: 1.5; }
#auth-loading { height: 54px; border-radius: 14px; margin-bottom: 0; background: linear-gradient(90deg, rgba(255,255,255,.04) 25%, rgba(255,255,255,.1) 50%, rgba(255,255,255,.04) 75%); background-size: 200% 100%; animation: lshimmer 1.4s infinite; }
#google-login { position: relative; width: 100%; height: 54px; display: none; align-items: center; justify-content: center; gap: .7rem; border: none; border-radius: 14px; cursor: pointer;
    font: 700 1rem 'Outfit', sans-serif; color: #111827; background: #fff; overflow: hidden; box-shadow: 0 10px 30px -8px rgba(211,23,25,.55), 0 0 0 1px rgba(255,255,255,.2); transition: box-shadow .3s, transform .2s; }
#google-login:hover { box-shadow: 0 16px 40px -8px rgba(211,23,25,.75), 0 0 0 1px rgba(255,255,255,.4); }
#google-login:active { transform: scale(.98); }
#google-login:focus-visible { outline: 3px solid var(--red2); outline-offset: 3px; }
#google-login svg { width: 20px; height: 20px; flex-shrink: 0; }
#google-login .shine { position: absolute; inset: 0; background: linear-gradient(110deg, transparent 35%, rgba(211,23,25,.12) 50%, transparent 65%); transform: translateX(-100%); animation: lshine 3.6s ease-in-out infinite 1.2s; pointer-events: none; }
#google-login .arr { transition: transform .25s; } #google-login:hover .arr { transform: translateX(4px); }
.l-trust { list-style: none; margin: 1.5rem 0 0; padding: 1.2rem 0 0; border-top: 1px solid var(--l-line); display: flex; flex-direction: column; gap: .7rem; }
.l-trust li { display: flex; gap: .65rem; align-items: flex-start; font-size: .84rem; line-height: 1.45; color: #cbd5e1; }
.l-trust li svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: .1rem; color: #34d399; }
.l-trust a, .l-help a { color: #fca5a5; text-decoration: none; border-bottom: 1px dashed rgba(252,165,165,.4); }
.l-trust a:hover, .l-help a:hover { color: #fff; }
.l-help a { white-space: nowrap; }
.l-help { margin-top: 1rem; display: flex; align-items: center; gap: .75rem; padding: .85rem 1rem; border-radius: 16px; background: rgba(255,255,255,.035); border: 1px solid var(--l-line); font-size: .82rem; color: var(--l-mut); }
.l-help .l-av { width: 38px; height: 38px; } .l-help .l-av:after { border-color: #0f1522; }
.l-help b { display: block; color: #fff; font-size: .86rem; }
.l-foot { grid-area: foot; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: .74rem; color: rgba(148,163,184,.7); padding-top: .4rem; }
.l-foot a { color: inherit; }

@keyframes lping { 0%,100% { box-shadow: 0 0 0 0 rgba(248,113,113,.55); } 50% { box-shadow: 0 0 0 6px rgba(248,113,113,0); } }
@keyframes lbreathe { 0%,100% { transform: scale(1); box-shadow: 0 6px 22px rgba(211,23,25,.45); } 50% { transform: scale(1.08); box-shadow: 0 6px 40px rgba(211,23,25,.75); } }
@keyframes lshimmer { to { background-position: -200% 0; } }
@keyframes lshine { 0%, 60% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
@keyframes lspin { to { --ang: 360deg; } }
@keyframes lblink { 50% { opacity: 0; } }
@keyframes ldot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

@media (max-width: 1100px) { .l-tab span.d { display: none; } .l-body { grid-template-columns: 1fr; } .l-side { display: none; } }
@media (max-width: 960px) {
    .login-shell { grid-template-columns: minmax(0, 1fr); grid-template-areas: "intro" "card" "show" "foot"; row-gap: 1.4rem;
        padding: max(1.4rem, env(safe-area-inset-top)) max(1.1rem, env(safe-area-inset-right)) max(1.2rem, env(safe-area-inset-bottom)) max(1.1rem, env(safe-area-inset-left)); }
    .l-card-wrap { position: static; margin-top: 0; }
    .l-eyebrow { margin-top: 1.4rem; }
}
@media (max-width: 600px) {
    .l-tabs { grid-template-columns: repeat(2, 1fr); }
    .l-kpis { grid-template-columns: repeat(2, 1fr); } .l-body { height: 440px; }
    .l-grid2 { grid-template-columns: 1fr; } .l-grid2 > .l-card:last-child { display: none; } .l-donut svg { width: 84px; height: 84px; }
    .l-login { padding: 1.6rem 1.3rem 1.3rem; } .l-login h2 { font-size: 1.35rem; } .l-sample { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    #auth-overlay *, #auth-overlay *:before, #auth-overlay *:after { animation: none !important; transition: none !important; }
}
