/* /chat/evenergy hosted chat — Tailwind-driven layout.
 *
 * The page-level structure (header, composer, hero, chips) is now expressed
 * via Tailwind utility classes on the elements directly. This file holds
 * only:
 *   1. Body background override (eve.css's .background-gradient is replaced
 *      by a Tailwind radial in the template).
 *   2. Dynamic message-bubble styles, since the JS in chat-evenergy.js
 *      injects elements with these classes at runtime and Tailwind classes
 *      can't be applied to runtime-created DOM without a build.
 *
 * Brand colours (sampled from docs/internal/brand/eve-intro.png):
 *   #0e2b2e   page bg
 *   #11353a   surface (island)
 *   #163e44   elevated (chips, composer, status pill)
 *   #50FB60   primary lime
 */

/* ── Body background — overrides eve.css's .background-gradient ────────── */

body.chat-evenergy-body {
    background: #0e2b2e;
}
body.chat-evenergy-body .background-gradient {
    /* eve.css ships this div with a blue-black radial. We don't render the
     * div in the template anymore, but if anything else inserts it the
     * brand teal still wins. */
    background: #0e2b2e;
    background-image: none;
}

/* Soft brand glow behind the chat island. The two-stop radial echoes the
 * brand sheet's right-panel ambience. */
.chat-evenergy-glow {
    background-image:
        radial-gradient(ellipse 60% 45% at 50% 35%, rgba(80, 251, 96, 0.10) 0%, transparent 60%),
        radial-gradient(ellipse 70% 50% at 50% 100%, rgba(80, 251, 96, 0.05) 0%, transparent 55%);
}

/* On-brand type (ev.energy brand system v1.0): Source Sans 3 body, Barlow
 * Condensed 800 uppercase headings. body.chat-evenergy-body * beats eve.css's
 * bare h1/h2/h3 rule on specificity (class on body > bare element). Mirrors
 * landing.css so the chat surface matches the rest of /connect. */
body.chat-evenergy-body,
body.chat-evenergy-body * {
    font-family: 'Source Sans 3', Inter, system-ui, -apple-system, sans-serif;
    text-transform: none;
    letter-spacing: 0;
}

/* Page headings (the hero, panel titles) → Barlow Condensed 800, uppercase.
 * The ` *` descendant selectors carry the face onto inline accent <span>s.
 * Markdown headings inside Eve's chat replies are reset back to sentence-case
 * body type below (see .chat-evenergy-message rules) — uppercase condensed
 * would be wrong for prose. */
body.chat-evenergy-body h1, body.chat-evenergy-body h2, body.chat-evenergy-body h3,
body.chat-evenergy-body h1 *, body.chat-evenergy-body h2 *, body.chat-evenergy-body h3 * {
    font-family: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;
    text-transform: uppercase;
}
body.chat-evenergy-body h1 { font-weight: 800; letter-spacing: 0.02em; line-height: 0.95; }
body.chat-evenergy-body h2 { font-weight: 800; letter-spacing: 0.02em; line-height: 0.95; }
body.chat-evenergy-body h3 { font-weight: 800; letter-spacing: 0.03em; line-height: 1.0; }

/* INTRO: the composer + starters sit in the hero's LEFT column exactly like the
   home page's search box (DRY — same two-column hero). Spacing mirrors home. */
body.connect-hero-wide .connect-hero-copy #composer {
    margin-top: 1.5rem;
}
body.connect-hero-wide .connect-hero-copy #quickstart {
    margin-top: 0.75rem;
}

/* ACTIVE (first message → body.chat-active): fade the intro copy / Eve card /
   starters and collapse the two-column grid to a single centered ~48rem column
   (chat-engine width), so the live thread reads like a normal chat. */
body.connect-hero-wide.chat-active #introCopy,
body.connect-hero-wide.chat-active #introCard,
body.connect-hero-wide.chat-active #quickstart {
    display: none;
}
body.connect-hero-wide.chat-active .connect-hero-grid {
    grid-template-columns: minmax(0, 48rem);
    justify-content: center;
    align-items: start;
}
/* Icons flush to the left edge of the centered chat column. width:100% stops
   the flex wrap collapsing to its content under the column's auto margins. */
body.connect-hero-wide.chat-active .connect-app-icons-wrap {
    width: 100%;
    max-width: 48rem;
    margin: 0 auto;
}

/* ── Scroll-edge fade ──────────────────────────────────────────────────── */

/* Gentle Google/Gemini-style softening at the top and bottom of the
 * scrollable conversation pane: as messages scroll past the edges they
 * fade out against the page background instead of clipping hard against
 * the floating header / composer. Applied via mask-image so it works on
 * any background (no opaque overlay needed) and respects content alpha. */
.chat-evenergy-scroll-fade {
    -webkit-mask-image: linear-gradient(
        to bottom,
        transparent 0,
        #000 28px,
        #000 calc(100% - 28px),
        transparent 100%
    );
            mask-image: linear-gradient(
        to bottom,
        transparent 0,
        #000 28px,
        #000 calc(100% - 28px),
        transparent 100%
    );
}

/* ── Dynamic message bubbles (created by chat-evenergy.js) ─────────────── */

@keyframes cevenFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.chat-evenergy-message {
    border-radius: 14px;
    padding: 0.75rem 1rem;
    max-width: 85%;
    line-height: 1.55;
    font-size: 0.95rem;
    color: #ffffff;
    animation: cevenFadeIn 0.25s ease-out;
    /* Defence against long unbroken strings (URLs, hex IDs, JWT
     * tokens) overflowing the bubble and the surrounding column.
     * ``overflow-wrap: anywhere`` lets the browser break mid-word
     * only when no normal break point fits — gentler than
     * ``word-break: break-all`` which breaks every line. */
    overflow-wrap: anywhere;
}

.chat-evenergy-message,
.chat-evenergy-message p,
.chat-evenergy-message ul,
.chat-evenergy-message ol,
.chat-evenergy-message li,
.chat-evenergy-message h1,
.chat-evenergy-message h2,
.chat-evenergy-message h3,
.chat-evenergy-message h4,
.chat-evenergy-message strong,
.chat-evenergy-message em,
.chat-evenergy-message blockquote,
.chat-evenergy-message table,
.chat-evenergy-message th,
.chat-evenergy-message td {
    color: inherit;
}

.chat-evenergy-message p { margin: 0 0 0.5rem; }
.chat-evenergy-message p:last-child { margin-bottom: 0; }

/* Tailwind preflight (app.css) resets all `ul, ol` to
 * ``list-style: none; padding: 0; margin: 0`` globally. Without
 * restoring those here, list items inside chat bubbles render as
 * unmarked indented blobs that look like accidental whitespace.
 * Bring the markers back, tight to the text. */
.chat-evenergy-message ul {
    list-style: disc outside;
    margin: 0.35rem 0 0.5rem;
    padding-left: 1.1rem;  /* just enough room for the disc */
}
.chat-evenergy-message ol {
    list-style: decimal outside;
    margin: 0.35rem 0 0.5rem;
    padding-left: 1.4rem;
}
.chat-evenergy-message li { margin: 0.15rem 0; }
.chat-evenergy-message li::marker {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.85em;
}

/* Markdown headings inside Eve's replies stay sentence-case body type — the
 * descendant selectors keep the page-chrome Barlow/uppercase rule above off
 * any inline spans (e.g. bold/code) within a reply heading. */
.chat-evenergy-message h1,
.chat-evenergy-message h2,
.chat-evenergy-message h3,
.chat-evenergy-message h4,
.chat-evenergy-message h1 *,
.chat-evenergy-message h2 *,
.chat-evenergy-message h3 *,
.chat-evenergy-message h4 * {
    margin: 0.5rem 0 0.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-transform: none;
    font-family: inherit;
}
.chat-evenergy-message h1 { font-size: 1.1rem; }
.chat-evenergy-message h2 { font-size: 1.02rem; }
.chat-evenergy-message h3 { font-size: 0.96rem; }
.chat-evenergy-message h4 { font-size: 0.92rem; }

.chat-evenergy-message code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.88em;
    background: rgba(255, 255, 255, 0.08);
    padding: 0.1em 0.35em;
    border-radius: 4px;
}

.chat-evenergy-message pre {
    margin: 0.5rem 0;
    padding: 0.7rem 0.85rem;
    background: rgba(0, 0, 0, 0.32);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    overflow-x: auto;
}
.chat-evenergy-message pre code {
    background: transparent;
    padding: 0;
    border-radius: 0;
}

.chat-evenergy-message blockquote {
    margin: 0.5rem 0;
    padding-left: 0.75rem;
    border-left: 3px solid rgba(80, 251, 96, 0.5);
    color: #a7b4b8;
}

.chat-evenergy-message table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.5rem 0;
    font-size: 0.9em;
}
.chat-evenergy-message th,
.chat-evenergy-message td {
    border: 1px solid rgba(255, 255, 255, 0.10);
    padding: 0.4rem 0.6rem;
    text-align: left;
}
.chat-evenergy-message a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.chat-evenergy-message--user {
    align-self: flex-end;
    background: #50FB60;
    color: #0a0f14;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 18px rgba(80, 251, 96, 0.18);
}

.chat-evenergy-message--assistant {
    align-self: flex-start;
    background: #163e44;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom-left-radius: 4px;
}

.chat-evenergy-message--error {
    align-self: flex-start;
    background: rgba(239, 68, 68, 0.10);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #ef4444;
}

/* ── App-action banner (deferred-write cue) ───────────────────────────── */
/* Surfaces ``ChatMessageResponse.requires_app_action`` from the chat
 * backend. Triggered by tools that can't complete in chat today (the
 * four deferred verbs + any v2 write that 403s). Visual cue reinforces
 * Eve's text reply for skim-readers; copy lives in chat.js. Amber tone
 * is informational, not an error — the user wasn't blocked, just
 * redirected to the app. */
.chat-evenergy-app-action-banner {
    align-self: stretch;
    margin: 4px 0;
    padding: 10px 14px;
    background: rgba(234, 179, 8, 0.10);
    border: 1px solid rgba(234, 179, 8, 0.35);
    border-radius: 8px;
    color: var(--primary-text);
    font-size: 0.9rem;
    line-height: 1.4;
}

/* ── Degraded-path banner (wizard-bypass disengaged) ─────────────────── */
/* Surfaces ``ChatMessageResponse.degraded`` from the chat backend.
 * Today only triggered by ``connect_device`` when the wizard-bypass
 * couldn't get the OEM URL directly — the popup target is v2's
 * wizard page instead of the OEM auth page. The URL still works on
 * cookie-bearing surfaces (askeve.energy via Clerk SSO); we just
 * want the driver pre-informed in case they see the v2 sign-in
 * screen. Blue tone — distinct from the amber app-action banner —
 * because this is informational, not "redirected away". */
.chat-evenergy-degraded-banner {
    align-self: stretch;
    margin: 4px 0;
    padding: 10px 14px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.30);
    border-radius: 8px;
    color: var(--primary-text);
    font-size: 0.9rem;
    line-height: 1.4;
}

/* ── Device-onboarding affordance ─────────────────────────────────── */
/* Rendered when a tool result carries a ``device_onboarding`` ui_hint
 * (today: ``connect_device`` in ai/tools/connect_verbs.py). Card +
 * primary-coloured button that pops the v2 onboarding URL in a new
 * window; chat.js auto-sends a follow-up turn when the window closes
 * so Eve confirms via view(). */
.chat-device-onboarding {
    align-self: stretch;
    margin: 6px 0;
    padding: 14px 16px;
    background: rgba(80, 251, 96, 0.06);
    border: 1px solid rgba(80, 251, 96, 0.30);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-device-onboarding__copy {
    margin: 0;
    color: var(--primary-text);
    font-size: 0.9rem;
    line-height: 1.4;
}

.chat-device-onboarding__btn {
    align-self: flex-start;
    padding: 8px 16px;
    background: var(--eve-primary, #50FB60);
    color: #0a0f14;
    border: none;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: box-shadow 120ms ease;
}

.chat-device-onboarding__btn:hover:not(:disabled) {
    box-shadow: 0 4px 18px rgba(80, 251, 96, 0.32);
}

.chat-device-onboarding__btn:disabled {
    opacity: 0.6;
    cursor: progress;
}

/* Inline fallback when the browser blocks the popup — manual link
 * preserves the chat history (avoids nav-stomping the parent tab). */
.chat-device-onboarding__notice {
    color: var(--secondary-text, var(--primary-text));
    font-size: 0.85rem;
}

.chat-device-onboarding__manual-link {
    align-self: flex-start;
    color: var(--eve-primary, #50FB60);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: underline;
}

/* Referral card — the scannable QR + link Eve returns when a driver asks to
 * share. Same electric-outline shell as the connect cards above. */
.chat-referral-share {
    align-self: stretch;
    margin: 6px 0;
    padding: 16px;
    background: rgba(80, 251, 96, 0.06);
    border: 1px solid rgba(80, 251, 96, 0.30);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.chat-referral-share__qr {
    width: 200px;
    height: 200px;
    max-width: 70vw;
    border-radius: 12px;
    background: #fff;
    padding: 10px;
}

.chat-referral-share__link {
    max-width: 100%;
    padding: 8px 12px;
    background: var(--eve-elevated, #163e44);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 10px;
    font-size: 0.8rem;
    color: var(--primary-text, #fff);
    word-break: break-all;
    text-align: center;
}

.chat-referral-share__actions {
    display: flex;
    gap: 8px;
}

.chat-referral-share__btn {
    padding: 8px 16px;
    background: transparent;
    color: var(--primary-text, #fff);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: box-shadow 120ms ease, border-color 120ms ease;
}

.chat-referral-share__btn:hover {
    border-color: var(--eve-primary, #50FB60);
}

.chat-referral-share__btn--primary {
    background: var(--eve-primary, #50FB60);
    color: #0a0f14;
    border-color: transparent;
}

.chat-referral-share__btn--primary:hover {
    box-shadow: 0 4px 18px rgba(80, 251, 96, 0.32);
}

/* ── Tool-call group (one row per tool, ticked) ───────────────────────── */
/* Mirrors the B2B Eve `.tool-group` aesthetic: a quiet column of
 * ticked one-liners attached above the assistant reply, not a chip
 * banner mid-conversation. Each row is its own `.cev-tool-line`
 * with a green-disc tick and a humanised verb label. Failed calls
 * use the warn variant so the developer sees the failure inline. */

.cev-tool-group {
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    max-width: 85%;
}

.cev-tool-line {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0 4px 2px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.3;
}

.cev-tool-line .check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(80, 251, 96, 0.12);
    color: #50FB60;
    flex-shrink: 0;
}
.cev-tool-line .check svg {
    width: 11px;
    height: 11px;
}

.cev-tool-line .name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Failed tool: red disc with X. Tooltip carries the truncated error
 * string the backend attaches to each call entry. */
.cev-tool-line--failed { color: rgba(239, 68, 68, 0.85); }
.cev-tool-line--failed .check {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

/* ── Thinking dots ─────────────────────────────────────────────────────── */

.chat-evenergy-thinking {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 0.9rem;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #163e44;
    color: #a7b4b8;
    font-size: 0.85rem;
    border-bottom-left-radius: 4px;
    animation: cevenFadeIn 0.2s ease-out;
}

.chat-evenergy-thinking__dots {
    display: inline-flex;
    gap: 4px;
}
.chat-evenergy-thinking__dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.4;
    animation: cevenDot 1.2s ease-in-out infinite;
}
.chat-evenergy-thinking__dots span:nth-child(2) { animation-delay: 0.15s; }
.chat-evenergy-thinking__dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes cevenDot {
    0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
    40%           { opacity: 1; transform: translateY(-2px); }
}

/* ----------------------------------------------------------------------
 * "Eve, everywhere" footer — chat.html bottom section
 *
 * Tasteful patch-bay aesthetic. A "sticker board" of supported AI clients
 * sits above a hairline, with protocol ports + the server URL chip below.
 * The chevron expands the JSON config snippet for the sophisticated user.
 *
 * Aesthetic intent: quiet, confident, integration-savvy. Not a hero CTA.
 * The driver does NOT need this — it's there to assure them that Eve is
 * not a walled garden and to give power users a one-click escape hatch.
 *
 * Brand vars come through the theme; we only set hue + opacity here so
 * the block stays cohesive with the rest of the connect surface.
 * ---------------------------------------------------------------------- */

.chat-evenergy-everywhere {
    margin-top: 1.25rem;
    padding: 1rem 1.125rem 1.125rem;
    border: 1px solid hsla(0, 0%, 100%, 0.06);
    border-radius: 1.25rem;
    /* Subtle inner glow so the block reads as part of the surface
     * without competing with the conversation above it. */
    background:
        radial-gradient(ellipse 80% 60% at 50% 0%, rgba(80, 251, 96, 0.04) 0%, transparent 70%),
        rgba(17, 53, 58, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.chat-evenergy-everywhere__heading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.875rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(167, 180, 184, 0.7);
}

.chat-evenergy-everywhere__heading-dot {
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #50FB60;
    box-shadow: 0 0 6px rgba(80, 251, 96, 0.6);
}

/* Sticker board of AI clients. Tiles are visual proof points — the
 * monogram + label tells the visitor "this Eve also lives in those
 * clients". They are not links (per-client setup docs are a follow-up). */
.chat-evenergy-clients {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
}

.chat-evenergy-clients__tile {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.625rem 0.35rem 0.45rem;
    border: 1px solid hsla(0, 0%, 100%, 0.08);
    border-radius: 999px;
    background: rgba(14, 43, 46, 0.55);
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.74rem;
    font-weight: 500;
    letter-spacing: -0.005em;
    transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.chat-evenergy-clients__tile:hover {
    border-color: hsla(0, 0%, 100%, 0.18);
    background: rgba(22, 62, 68, 0.7);
    color: #ffffff;
}

.chat-evenergy-clients__tile svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    flex-shrink: 0;
}

.chat-evenergy-clients__label {
    white-space: nowrap;
}

/* Tinted brand cues — each client gets a faint colour hint so the row
 * doesn't read as five identical chips. Kept very low saturation so
 * the footer stays calm. */
.chat-evenergy-clients__tile[data-client="claude"]:hover  { color: #d97757; border-color: rgba(217, 119, 87, 0.4); }
.chat-evenergy-clients__tile[data-client="chatgpt"]:hover { color: #10a37f; border-color: rgba(16, 163, 127, 0.45); }
.chat-evenergy-clients__tile[data-client="cursor"]:hover  { color: #ffffff; border-color: rgba(255, 255, 255, 0.35); }
.chat-evenergy-clients__tile[data-client="gemini"]:hover  { color: #4796e3; border-color: rgba(71, 150, 227, 0.45); }
.chat-evenergy-clients__tile[data-client="alexa"]:hover   { color: #00caff; border-color: rgba(0, 202, 255, 0.45); }

/* Patch-bay hairline. Pure decoration that hints "the clients above
 * flow into the protocols below". */
.chat-evenergy-everywhere__hairline {
    height: 1px;
    margin: 0.25rem 0 0.875rem;
    background: linear-gradient(
        90deg,
        transparent 0%,
        hsla(0, 0%, 100%, 0.08) 18%,
        hsla(0, 0%, 100%, 0.14) 50%,
        hsla(0, 0%, 100%, 0.08) 82%,
        transparent 100%
    );
}

/* Protocol + URL + toggle row. Flex layout: protocols left, URL fills,
 * toggle right. Wraps on narrow viewports — URL drops to its own line. */
.chat-evenergy-everywhere__row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.625rem;
    row-gap: 0.5rem;
}

.chat-evenergy-protocols {
    display: inline-flex;
    gap: 0.375rem;
    flex-shrink: 0;
}

.chat-evenergy-protocol {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.55rem;
    border: 1px solid rgba(80, 251, 96, 0.25);
    border-radius: 6px;
    background: rgba(80, 251, 96, 0.05);
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: #50FB60;
}

.chat-evenergy-protocol__dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #50FB60;
    box-shadow: 0 0 4px rgba(80, 251, 96, 0.7);
}

.chat-evenergy-server-url {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.4rem 0.7rem;
    border: 1px solid hsla(0, 0%, 100%, 0.08);
    border-radius: 8px;
    background: rgba(14, 43, 46, 0.55);
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.74rem;
    color: rgba(255, 255, 255, 0.78);
    overflow-x: auto;
    white-space: nowrap;
    /* Hide the noisy native scrollbar on this single chip — the URL
     * is short enough that horizontal touch-drag covers any overflow. */
    scrollbar-width: none;
}
.chat-evenergy-server-url::-webkit-scrollbar { display: none; }

.chat-evenergy-everywhere__toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.7rem;
    border: 1px solid hsla(0, 0%, 100%, 0.1);
    border-radius: 8px;
    background: rgba(14, 43, 46, 0.55);
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.74rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.chat-evenergy-everywhere__toggle:hover {
    border-color: rgba(80, 251, 96, 0.5);
    color: #50FB60;
    background: rgba(22, 62, 68, 0.7);
}

.chat-evenergy-everywhere__toggle svg {
    width: 12px;
    height: 12px;
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-evenergy-everywhere__toggle[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

/* Expanded config snippet — borrowed visual language from the existing
 * referral snippet so the surface feels consistent. */
.chat-evenergy-everywhere__config {
    margin-top: 0.875rem;
    padding-top: 0.875rem;
    border-top: 1px dashed hsla(0, 0%, 100%, 0.07);
    animation: cevenExpand 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes cevenExpand {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.chat-evenergy-everywhere__hint {
    margin: 0 0 0.625rem;
    font-size: 0.78rem;
    color: rgba(167, 180, 184, 0.85);
}

.chat-evenergy-everywhere__snippet {
    position: relative;
}

.chat-evenergy-everywhere__snippet pre {
    margin: 0;
    padding: 0.75rem 4.25rem 0.75rem 0.875rem;
    border: 1px solid hsla(0, 0%, 100%, 0.1);
    border-radius: 0.75rem;
    background: rgba(22, 62, 68, 0.6);
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.74rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.85);
    overflow-x: auto;
}

.chat-evenergy-everywhere__copy {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.3rem 0.65rem;
    border: 1px solid hsla(0, 0%, 100%, 0.14);
    border-radius: 0.5rem;
    background: rgba(14, 43, 46, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.18s, color 0.18s;
}

.chat-evenergy-everywhere__copy:hover {
    border-color: #50FB60;
    color: #50FB60;
}

/* No page-load fade animation. The chat surface is server-baked HTML —
 * render it directly. Each message bubble fades in once via cevenFadeIn
 * on .chat-evenergy-message; there is no per-word reveal. */

/* Deep-link target — the /connect landing's MCP + A2A cards link to
 * /connect/account#plug-eve-in. Offset the scroll anchor below the
 * fixed header (~5rem) so the panel heading isn't hidden under it when
 * the browser jumps to the fragment. */
#plug-eve-in {
    scroll-margin-top: 5.5rem;
}

/* "Eve anywhere" — internal sub-section styles (native + integration
 * coexist in the same card). Sublabel small caps for visual hierarchy
 * between native (App/Play) and AI clients (Claude/ChatGPT/etc.). */
.chat-evenergy-anywhere__sublabel {
    margin: 0 0 0.5rem;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(167, 180, 184, 0.55);
}

.chat-evenergy-anywhere__native {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 0.875rem;
}

.chat-evenergy-anywhere__store {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.7rem;
    border-radius: 0.75rem;
    background: #ffffff;
    color: #0a0f14;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.chat-evenergy-anywhere__store:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.chat-evenergy-anywhere__store svg {
    flex-shrink: 0;
}

.chat-evenergy-anywhere__store-label {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
    text-align: left;
}

.chat-evenergy-anywhere__store-pre {
    font-size: 0.6rem;
    font-weight: 500;
    opacity: 0.7;
}

.chat-evenergy-anywhere__store-name {
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: -0.015em;
}

/* Scan-to-install QR — desktop-only, sits between the 'Native app'
 * sublabel and the App Store / Play Store badges. Labelled so it's
 * not confused with the personal-referral QR in the Earn block. */
.chat-evenergy-anywhere__install-qr {
    display: none;
    align-items: center;
    gap: 0.7rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.75rem;
    background: rgba(14, 43, 46, 0.55);
    border: 1px solid hsla(0, 0%, 100%, 0.08);
}

@media (min-width: 768px) {
    .chat-evenergy-anywhere__install-qr { display: flex; }
}

.chat-evenergy-anywhere__install-qr-img {
    display: block;
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    border-radius: 0.4rem;
    background: #ffffff;
    padding: 4px;
    image-rendering: pixelated;
}

.chat-evenergy-anywhere__install-qr-label {
    font-size: 0.74rem;
    color: rgba(255, 255, 255, 0.78);
    line-height: 1.3;
}

/* Compact-row variant of the AI client tiles — icon-only squares,
 * no wrap. Used inside Eve-anywhere card where vertical real estate
 * is tight. Tooltip via the host element's title attr. */
.chat-evenergy-anywhere__clients-row {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-wrap: nowrap;
}

.chat-evenergy-anywhere__sublabel--inline {
    margin: 0;
    flex-shrink: 0;
    white-space: nowrap;
}

.chat-evenergy-clients--compact {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.375rem;
    margin: 0;
    padding: 0;
    list-style: none;
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-end;
}

.chat-evenergy-clients__tile--icon {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    gap: 0;
}

.chat-evenergy-clients__tile--icon svg {
    width: 16px;
    height: 16px;
}

/* Compact card padding override — applied to .chat-evenergy-anywhere
 * so the secondary row card stays tight even with the install-QR
 * + native badges + AI clients + protocol row inside it. */
.chat-evenergy-anywhere {
    padding: 1rem 1.125rem !important;
}

/* Site footer rules live in landing.css now — both chat.html and
 * landing.html load that file, so a single source of truth styles
 * the footer consistently on every connect surface. */

/* Native-app row inside the Eve-anywhere card — wraps the DRY
 * _app_icons.html partial. */
.chat-evenergy-anywhere__app-row {
    margin: 0.25rem 0 0.875rem;
}

/* ── Input dock — ONE box that morphs between the composer and the voice pill.
 *    chat.js flips [data-voice]; the box chrome lives on the dock so it stays
 *    continuous across the morph, and the pill overlays it in place (no jump). ── */
.chat-input-dock {
    position: relative;
    /* ONE height for both faces of the dock. It used to be 62px as a composer and 104px
       as a voice pill, animated between the two, so starting or ending a call grew the
       box and shoved the rest of the page down — "it grows clunkily and resizes/shifts".
       Reserving the taller height in both states costs a slightly roomier composer and
       buys a dock that never moves. The transition is gone with it: there is no longer
       anything to animate, and animating a layout box is what made it feel clunky. */
    min-height: 104px;
}
.chat-input-dock[data-voice="on"] {
    /* Height is already reserved above — only the ring changes here, so toggling the
       call repaints a border and nothing reflows. */
    /* Lime ring while a call is live, in place of the composer's focus glow. */
    border-color: rgba(80, 251, 96, 0.55);
    box-shadow: 0 0 0 3px rgba(80, 251, 96, 0.22), 0 24px 60px -30px rgba(0, 0, 0, 0.6);
}
.chat-dock-layer { transition: opacity 0.3s ease; }
.chat-input-dock[data-voice="on"] .chat-dock-layer--text {
    opacity: 0;
    pointer-events: none;
    /* A grown textarea must not inflate the dock past the pill's height. */
    max-height: 0;
    overflow: hidden;
}

.chat-voice-pill {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 0.9rem;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.98);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.chat-input-dock[data-voice="on"] .chat-voice-pill {
    opacity: 1;
    pointer-events: auto;
    transform: none;
}
.chat-voice-pill__state {
    margin: 0;
    /* It doubles as the live caption, so it must absorb a long sentence without ever
       becoming a second line — a wrap here would reintroduce the reflow this fixes. */
    min-width: 0;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #a7b4b8;
}
/* Who has the floor. The dot takes the trail's own colours, so the two readings of
   "who is talking" are the same reading. */
.chat-voice-pill__head {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0 0.35rem;
}
.chat-voice-floor {
    flex: none;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #6f8083;
    transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.chat-voice-pill[data-floor="eve"] .chat-voice-floor {
    background: #50FB60;
    box-shadow: 0 0 0 3px rgba(80, 251, 96, 0.18);
}
.chat-voice-pill[data-floor="you"] .chat-voice-floor {
    background: #bfe4ea;
    box-shadow: 0 0 0 3px rgba(191, 228, 234, 0.18);
}
/* Barge-in: the driver cut in, so the pill acknowledges the handover rather than
   letting the trail change colour silently. One short pulse, then back. */
.chat-voice-pill[data-barge] .chat-voice-floor {
    transform: scale(1.5);
    background: #bfe4ea;
    box-shadow: 0 0 0 6px rgba(191, 228, 234, 0.28);
}

@media (prefers-reduced-motion: reduce) {
    .chat-voice-floor { transition: none; }
    .chat-voice-pill[data-barge] .chat-voice-floor { transform: none; }
}

.chat-voice-pill__row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.chat-voice-wave {
    flex: 1;
    min-width: 0;
    height: 40px;
    display: block;
}
.chat-voice-round {
    flex: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid transparent;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.chat-voice-round svg { width: 18px; height: 18px; }
.chat-voice-round--end {
    background: rgba(239, 68, 68, 0.14);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ff6b6b;
}
.chat-voice-round--end:hover {
    transform: translateY(-1px);
    background: rgba(239, 68, 68, 0.24);
}
.chat-voice-round--mic {
    background: #50FB60;
    color: #0a0f14;
    box-shadow: 0 6px 18px rgba(80, 251, 96, 0.3);
}
.chat-voice-round--mic:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(80, 251, 96, 0.45);
}
.chat-voice-round--mic[data-muted="1"] {
    background: rgba(255, 255, 255, 0.1);
    color: #a7b4b8;
    box-shadow: none;
}
.chat-voice-round:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-voice-round:disabled:hover { transform: none; box-shadow: none; }
