/* ── Property Assistant (/search) ──────────────────────────────────────────
   Two-column results page: this file styles only the assistant column.
   Desktop: the panel lives in a sticky left column (sticky placement comes
   from #search.html's #pmh-ai-col rules). Mobile: the CTA becomes a fixed
   launcher bubble and the panel opens as a bottom sheet. */

:root {
    --pmh-ai-gold: #b98a2f;
    --pmh-ai-gold2: #a3761f;
}

/* ── CTA (desktop: card in the column; mobile: fixed launcher pill) ─────── */

.pmh-ai-cta {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: 1px dashed var(--sage, #929783);
    border-radius: 16px;
    background: linear-gradient(135deg, #fbfcf9, #f3f5ec);
}

.pmh-ai-cta[hidden] { display: none !important; }

.pmh-ai-cta-icon {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, var(--pmh-ai-gold), var(--pmh-ai-gold2));
}

.pmh-ai-cta-icon svg { width: 20px; height: 20px; }

.pmh-ai-cta-text { flex: 1 1 auto; min-width: 0; }

.pmh-ai-cta-title {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: var(--charcoal, #373e4f);
}

.pmh-ai-cta-sub {
    display: block;
    margin-top: 2px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--body-muted, #6d7998);
}

.pmh-ai-open-btn {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: 9px 18px;
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

/* ── panel ─────────────────────────────────────────────────────────────── */

.pmh-ai-panel {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e8e9e2;
    border-radius: 20px;
    box-shadow: 0 14px 40px rgba(7, 27, 58, .09);
    overflow: hidden;
    font-family: "Inter", system-ui, -apple-system, sans-serif;
}

.pmh-ai-panel[hidden] { display: none !important; }

.pmh-ai-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "name close"
        "sub  sub"
        "stat stat";
    align-items: center;
    gap: 0 10px;
    padding: 12px 14px;
    border-bottom: 1px solid #f0f1ea;
    background: #fff;
}

.pmh-ai-head-left { grid-area: name; display: flex; align-items: center; gap: 10px; min-width: 0; }

.pmh-ai-avatar {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, var(--pmh-ai-gold), var(--pmh-ai-gold2));
}

.pmh-ai-avatar svg { width: 18px; height: 18px; }

.pmh-ai-name {
    min-width: 0;
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--charcoal, #373e4f);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pmh-ai-subtitle {
    grid-area: sub;
    margin: 3px 0 0;
    font-size: 11.5px;
    line-height: 1.4;
    color: var(--body-muted, #6d7998);
    /* One line on every device so desktop and mobile headers match. */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pmh-ai-status {
    grid-area: stat;
    margin: 1px 0 0;
    font-size: 12px;
    color: var(--body-muted, #6d7998);
    /* One line always: the long /search status used to wrap to two lines,
       making the panel header 18px taller than the property-page one. */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pmh-ai-close {
    grid-area: close;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid transparent;
    background: transparent;
    color: var(--body-muted, #6d7998);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
}

.pmh-ai-close:hover { background: #eef0f5; color: var(--charcoal, #373e4f); }

/* requirement chips */

.pmh-ai-reqs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 8px 16px 8px;
}

.pmh-ai-reqs[hidden] { display: none !important; }

.pmh-ai-reqs-label {
    flex: 0 0 auto;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--body-muted, #6d7998);
    margin-right: 2px;
}

.pmh-ai-req {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 9px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.1;
    color: #4f5a42;
    background: #eef2e6;
    border: 1px solid #dfe5d4;
    border-radius: 999px;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}

.pmh-ai-req:hover { background: #e8eedd; border-color: var(--sage, #929783); }

.pmh-ai-req:focus-visible { outline: 2px solid var(--sage, #929783); outline-offset: 2px; }

.pmh-ai-req-x {
    color: #7c866c;
    font-size: 14px;
    line-height: 1;
}

/* conversation — flexible filler so the mostly-empty panel reads like the mock */

/* ChatGPT-style: ONE scroll surface for the whole conversation. The log no
   longer scrolls internally; log + refined chip + suggestion chips scroll
   together so a reply is never clipped midway while its chips are below. */
.pmh-ai-scroll {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.pmh-ai-log {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
    min-height: 140px;
}

.pmh-ai-msg {
    max-width: 90%;
    font-size: 14px;
    line-height: 1.55;
    padding: 9px 13px;
    border-radius: 14px;
    word-wrap: break-word;
}

.pmh-ai-msg p { margin: 0 0 6px; }
.pmh-ai-msg p:last-child { margin-bottom: 0; }
.pmh-ai-msg ul { margin: 4px 0 6px; padding-left: 18px; }
.pmh-ai-msg li { margin: 2px 0; }

.pmh-ai-msg.bot {
    align-self: flex-start;
    max-width: 100%;            /* the assistant speaks full width */
    background: #f5f6f0;
    border: 1px solid #e9ecdf;
    color: var(--charcoal, #373e4f);
    border-bottom-left-radius: 5px;
}

.pmh-ai-msg.user {
    align-self: flex-end;
    background: var(--sage, #929783);
    color: #fff;
    border-bottom-right-radius: 5px;
}

.pmh-ai-msg.error {
    align-self: center;
    max-width: 100%;
    font-size: 12.5px;
    background: #fdf2f2;
    border: 1px solid #f3d9d9;
    color: #964343;
    border-radius: 12px;
    text-align: center;
}

.pmh-ai-msg a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

.pmh-ai-typing {
    align-self: flex-start;
    display: inline-flex;
    gap: 4px;
    padding: 11px 14px;
    border-radius: 14px;
    border-bottom-left-radius: 5px;
    background: #f5f6f0;
    border: 1px solid #e9ecdf;
}

.pmh-ai-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #a8b09a;
    animation: pmhAiDot 1.1s infinite ease-in-out;
}

.pmh-ai-typing span:nth-child(2) { animation-delay: .15s; }
.pmh-ai-typing span:nth-child(3) { animation-delay: .3s; }

@keyframes pmhAiDot {
    0%, 80%, 100% { transform: translateY(0); opacity: .55; }
    40% { transform: translateY(-3px); opacity: 1; }
}

/* "results updated" system line */

.pmh-ai-updated {
    align-self: center;
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    max-width: 100%;
    font-size: 12.5px;
    color: var(--body-muted, #6d7998);
    background: #f7f8f4;
    border: 1px solid #e9ecdf;
    border-radius: 999px;
    padding: 5px 12px;
}

.pmh-ai-updated button {
    border: none;
    background: transparent;
    color: #5c6b4c;
    font-weight: 700;
    font-size: 12.5px;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    padding: 0;
}

/* assistant quick replies */

.pmh-ai-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 16px 10px;
}

.pmh-ai-chips:empty { display: none; }

/* grid shimmer while a chat refinement re-runs the engine */
#search-results.pmh-updating {
    opacity: .55;
    filter: saturate(.75);
    transition: opacity .2s ease;
    pointer-events: none;
}

/* smart chips (one missing level at a time) above the composer */
.pmh-ai-chip {
    border: 1px solid var(--input-border, #cdd1de);
    background: #fff;
    color: var(--charcoal, #373e4f);
    font-size: 12.5px;
    font-weight: 600;
    border-radius: 999px;
    padding: 5px 12px;
    cursor: pointer;
    transition: box-shadow .15s ease, border-color .15s ease;
}

.pmh-ai-chip:hover { border-color: var(--sage, #929783); box-shadow: 0 2px 8px rgba(7, 27, 58, .08); }

/* composer */

.pmh-ai-form {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-top: 1px solid #f0f1ea;
    background: #fff;
}

.pmh-ai-input {
    flex: 1 1 auto;
    min-width: 0;
    border: 1px solid #d8dcd0;
    border-radius: 999px;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--charcoal, #373e4f);
    background: #fff;
    outline: none;
}

.pmh-ai-input::placeholder { color: #9aa3ad; }

.pmh-ai-input:focus {
    border-color: var(--pmh-ai-gold);
    box-shadow: 0 0 0 3px rgba(185, 138, 47, .12);
}

.pmh-ai-send {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, var(--pmh-ai-gold), var(--pmh-ai-gold2));
    transition: opacity .15s ease, transform .1s ease;
}

.pmh-ai-send:hover { opacity: .92; }
.pmh-ai-send:active { transform: scale(.96); }
.pmh-ai-send:disabled { opacity: .5; cursor: not-allowed; }

/* ── lead / callback capture form ─────────────────────────────────────── */

.pmh-ai-lead {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}

.pmh-ai-lead-ctx {
    margin: 0 0 2px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--body-muted, #6d7998);
}

.pmh-ai-lead-input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 12px;
    font-size: 14px;
    color: var(--charcoal, #373e4f);
    background: #fff;
    border: 1px solid var(--input-border, #cdd1de);
    border-radius: 10px;
    outline: none;
}

.pmh-ai-lead-input::placeholder { color: #9aa3ad; }

.pmh-ai-lead-input:focus {
    border-color: var(--pmh-ai-gold);
    box-shadow: 0 0 0 3px rgba(185, 138, 47, .12);
}

.pmh-ai-lead-consent {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    font-size: 12px;
    line-height: 1.45;
    color: #5b657f;
    cursor: pointer;
}

.pmh-ai-lead-consent input { margin-top: 2px; flex: 0 0 auto; }

.pmh-ai-lead-btn {
    padding: 9px 14px;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--pmh-ai-gold), var(--pmh-ai-gold2));
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: filter .15s ease, transform .1s ease;
}

.pmh-ai-lead-btn:hover:not(:disabled) { filter: brightness(1.06); }
.pmh-ai-lead-btn:active:not(:disabled) { transform: scale(.98); }
.pmh-ai-lead-btn:disabled { opacity: .6; cursor: default; }

/* ── desktop column: panel fills the sticky column ─────────────────────── */

@media (min-width: 1024px) {
    #pmh-ai-panel {
        /* The sign-in + site-visit bars sit right below the panel: the
           available-height term leaves room for both so the full rail fits
           on one screen without scrolling. */
        height: min(72vh, calc(100vh - 210px), 690px);
        min-height: 380px;
    }

    /* Ensure search page chat rail positions identically to home page */
    #pmh-ai-col {
        position: sticky;
        top: 76px;
        margin-top: -72px;
    }
}

/* ── mobile: chat-first — the conversation is PART OF THE PAGE ───────────
   One white card (chat + both lead bars) inside the page gutter, sized so
   the first result card peeks above the fold. The composer can NEVER be
   clipped: header, refinement chips, suggestion chips and composer hold
   their size and the LOG is the piece that shrinks/scrolls. */

@media (max-width: 1023.98px) {
    /* One gutter for the whole mobile page: 14px (10px on very small
       phones, see the max-width:374px rule below). Chat strips use the
       same variable, so card, heading and result cards share one edge. */
    :root { --pmh-gutter: 14px; }

    main.search-main > .mobile-results-section {
        padding: var(--pmh-gutter) var(--pmh-gutter) 32px;
    }

    #pmh-ai-col {
        width: 100%;
        order: -1;                     /* chat leads the page */
        margin: 8px 0 0.875rem;        /* card sits inside the page gutter */
    }

    /* One white card wraps the conversation AND both lead bars so the
       footer strips read as part of the consultant, not stray sections.
       .pmh-detail-rail is the same rail on project/property detail pages —
       they get the identical card so the chat looks the same everywhere. */
    #pmh-ai-col .pmh-rail,
    .pmh-detail-rail .pmh-rail {
        background: #fff;
        border: 1px solid #e8e9e2;
        border-radius: 16px;
        box-shadow: 0 6px 22px rgba(7, 27, 58, .06);
        overflow: hidden;
    }

    /* No floating launcher bubble — the open chat IS the entry point.
       The CTA only appears (in-flow) if the visitor closes the chat. */
    .pmh-ai-cta { position: static; }

    /* Chat-first mobile: the conversation card is the ONLY thing under the
       navbar. The "Homes for …" heading and meta render BELOW it (SEO keeps
       them in the DOM), and the results follow after another swipe.
       NOTE: Bootstrap's .px-5/.pt-4 utilities are !important on this page,
       so these overrides must carry !important to win the cascade. */
    main.search-main > .mobile-results-section > .px-5 {
        display: flex;
        flex-direction: column;
        padding: 0.35rem 0 0 !important;   /* side gutter comes from the section's 14px */
    }
    /* Flatten the two-column wrapper so chat, heading, meta and results can
       be ordered as siblings: chat first, then the search summary. */
    .px-5 #search-body            { display: contents; }
    .px-5 #pmh-ai-col             { order: -3; }
    .px-5 h1.search-h1            { order: -2; margin-top: 0; }
    .px-5 #search-meta            { order: -1; margin-top: 0.15rem; }
    .px-5 #pmh-results-col        { order: 0; margin-top: 12px; }

    .pmh-ai-panel {
        position: static;
        width: 100%;                         /* true full width */
        height: clamp(300px, 46vh, 440px);   /* non-search pages: fixed sheet */
        max-height: none;
        background: transparent;
        border: none;
        border-radius: 0;
        box-shadow: none;
    }

    /* ── /search: the card IS the first screen ──────────────────────────
       It runs from its top edge down to the bottom of the viewport, so the
       visitor sees a whole conversation surface without scrolling and the
       H1/meta plus results begin on the next swipe. --pmh-ai-fit is measured
       in JS; the dvh value is the no-JS fallback (chat now sits directly
       under the navbar). Scoped to the chat rails (#pmh-ai-col on /search,
       .pmh-detail-rail on detail pages); the home takeover has its own
       rules in home-chat.css. */
    #pmh-ai-col .pmh-rail:has(#pmh-ai-panel:not([hidden])),
    .pmh-detail-rail .pmh-rail:has(#pmh-ai-panel:not([hidden])) {
        display: flex;
        flex-direction: column;
        height: var(--pmh-ai-fit, calc(100dvh - 96px));
    }
    #pmh-ai-col .pmh-ai-panel,
    .pmh-detail-rail .pmh-ai-panel {
        flex: 1 1 auto;
        min-height: 0;
        height: auto;
    }

    /* every strip spans the full bleed width — nothing centers narrower */
    .pmh-ai-reqs,
    .pmh-ai-scroll,
    .pmh-ai-log,
    .pmh-ai-chips,
    .pmh-ai-form { width: 100%; }

    /* fixed furniture: keep their height, never squeeze them out. The scroll
       region is the flexible piece; suggestion chips sit OUTSIDE it so they
       stay pinned above the composer and can never be scrolled out of view. */
    .pmh-ai-head,
    .pmh-ai-reqs,
    .pmh-ai-chips,
    .pmh-ai-form,
    #pmh-ai-col .pmh-ai-signin-bar,
    #pmh-ai-col .pmh-ai-visit-bar,
    .pmh-detail-rail .pmh-ai-signin-bar,
    .pmh-detail-rail .pmh-ai-visit-bar { flex: 0 0 auto; }
    .pmh-ai-scroll { flex: 1 1 auto; }

    /* ── compact header: name + compact close, one line each below ── */
    .pmh-ai-head {
        background: transparent;
        border-bottom: 1px solid rgba(15, 23, 42, .08);
        padding: 8px var(--pmh-gutter) 6px;
        gap: 0 8px;
        align-items: center;
    }
    .pmh-ai-head-left {
        flex: 1 1 auto;
        min-width: 0;
        gap: 8px;
        align-items: center;
    }
    .pmh-ai-avatar { width: 28px; height: 28px; }
    .pmh-ai-avatar svg { width: 13px; height: 13px; }
    .pmh-ai-name { font-size: 13.5px; }
    .pmh-ai-subtitle {
        font-size: 10.5px;
        line-height: 1.3;
        margin-top: 2px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .pmh-ai-status {
        font-size: 11px;
        line-height: 1.3;
        margin-top: 0;
        /* One line: the full refinement list lives in its own strip. */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    /* Close stays available on mobile too: the card collapses to the in-flow
       CTA bar. Compact so the header row keeps the same height as before. */
    .pmh-ai-close {
        width: 26px;
        height: 26px;
        font-size: 11px;
    }

    /* ── tidy conversation: compact bubbles, gutter-to-gutter ── */
    .pmh-ai-msg {
        max-width: 90%;
        font-size: 14px;              /* was 13.25 — chat-grade readability */
        line-height: 1.55;
        padding: 8px 12px;
        border-radius: 14px;
    }
    .pmh-ai-msg.bot { max-width: 100%; border-bottom-left-radius: 5px; }
    .pmh-ai-msg.user { border-bottom-right-radius: 5px; }
    .pmh-ai-msg.error { max-width: 100%; font-size: 12px; }
    .pmh-ai-updated { max-width: 100%; font-size: 12px; }
    .pmh-ai-typing { border-radius: 14px; border-bottom-left-radius: 5px; }

    /* ── inner strips over the page background ── */
    .pmh-ai-reqs {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        /* extra right padding keeps the last chip clear of the fade mask */
        padding: 5px 22px 5px var(--pmh-gutter);
        -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 18px), transparent);
        mask-image: linear-gradient(to right, #000 calc(100% - 18px), transparent);
    }
    .pmh-ai-reqs::-webkit-scrollbar { display: none; }
    .pmh-ai-reqs-label { font-size: 10.5px; }
    .pmh-ai-req { font-size: 11px; padding: 4px 8px; }
    .pmh-ai-chips {
        flex-wrap: wrap;
        overflow: visible;
        gap: 6px;
        padding: 5px var(--pmh-gutter) 6px;
    }
    .pmh-ai-chip {
        flex: 0 1 auto;
        padding: 4px 9px;
        font-size: 11.5px;
        line-height: 1.25;
        background: #fff;
        border-color: #d8dcd0;
    }

    /* ── the scroll surface scrolls; the log is plain content in it ── */
    .pmh-ai-log {
        min-height: 48px;
        gap: 9px;
        padding: 6px var(--pmh-gutter);
    }
    /* Long tokens (URLs, RERA strings) must wrap, never widen the column. */
    .pmh-ai-scroll { overflow-x: hidden; }
    .pmh-ai-msg { overflow-wrap: anywhere; }
    /* hide the scroller chrome, keep the clean chat look */
    .pmh-ai-scroll { scrollbar-width: none; }
    .pmh-ai-scroll::-webkit-scrollbar { display: none; }

    /* ── clean composer: full-width strip, pill input + gold send ── */
    .pmh-ai-form {
        background: transparent;
        border-top: 1px solid rgba(15, 23, 42, .07);
        padding: 6px var(--pmh-gutter) 8px;
        /* iOS safe area inset for home indicator on iPhone X+ */
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
        gap: 8px;
    }
    .pmh-ai-input {
        height: 42px;
        padding: 0 14px;
        font-size: 13.5px;
        background: #fff;
    }
    .pmh-ai-send { width: 42px; height: 42px; }

    /* Lead bars: attached to the card, one consistent strip each. */
    #pmh-ai-col .pmh-ai-signin-bar,
    #pmh-ai-col .pmh-ai-visit-bar,
    .pmh-detail-rail .pmh-ai-signin-bar,
    .pmh-detail-rail .pmh-ai-visit-bar {
        margin: 0;
        padding: 10px var(--pmh-gutter);
        border: 0;
        border-top: 1px solid #f0f1ea;
        border-radius: 0;
        box-shadow: none;
    }
    #pmh-ai-col .pmh-ai-signin-bar { background: #fdfaf3; }
    #pmh-ai-col .pmh-ai-visit-bar { background: #fff; }
}

@media (max-width: 374px) {
    :root { --pmh-gutter: 10px; }
}

@media (max-width: 400px) {
    /* In-flow CTA on small phones: keep both lines, just tighter */
    .pmh-ai-cta { padding: 11px 14px; gap: 10px; }
    .pmh-ai-cta-icon { width: 34px; height: 34px; }
    .pmh-ai-cta-title { font-size: 14px; }
    .pmh-ai-cta-sub { font-size: 12.5px; }
}

/* ── Sign-in suggestion bar ──────────────────────────────────────────────── */

.pmh-ai-signin-bar {
    margin-top: 12px;
    margin-left: 0;
    margin-right: 0;
    padding: 10px 14px;   /* Equal 14px on both sides to match chat gutter */
    background: #fdfaf3;
    border: 1px solid #f0e5d5;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(185, 138, 47, 0.08);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pmh-ai-signin-bar[hidden] { display: none !important; }

/* The sentence is wider than the rail, so one clipped line hid its point.
   Two identical copies scroll left as a single run; the duplicate makes the
   loop seamless instead of leaving a chopped edge. JS adds .is-scrolling
   only when the message actually overflows the track. */
.pmh-ai-signin-track {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}

.pmh-ai-signin-run {
    display: flex;
    width: max-content;
}

.pmh-ai-signin-message {
    flex: 0 0 auto;
    padding-right: 28px;
    font-size: 12px;
    font-weight: 600;
    color: var(--charcoal, #373e4f);
    line-height: 1.25;
    white-space: nowrap;
}

.pmh-ai-signin-track.is-scrolling {
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 10px, #000 calc(100% - 10px), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 10px, #000 calc(100% - 10px), transparent 100%);
}

.pmh-ai-signin-track.is-scrolling .pmh-ai-signin-run {
    animation: pmh-signin-marquee 20s linear infinite;
}

.pmh-ai-signin-bar:hover .pmh-ai-signin-track.is-scrolling .pmh-ai-signin-run,
.pmh-ai-signin-bar:focus-within .pmh-ai-signin-track.is-scrolling .pmh-ai-signin-run {
    animation-play-state: paused;
}

@keyframes pmh-signin-marquee {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* Reduced motion: show the whole sentence wrapped instead of truncating. */
@media (prefers-reduced-motion: reduce) {
    .pmh-ai-signin-run { width: 100%; flex-wrap: wrap; animation: none !important; }
    .pmh-ai-signin-message { flex: 1 1 auto; padding-right: 0; white-space: normal; }
    .pmh-ai-signin-message[aria-hidden="true"] { display: none; }
}

.pmh-ai-signin-icon {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    color: var(--pmh-ai-gold, #b98a2f);
}

.pmh-ai-signin-btn {
    flex: 0 0 auto;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--pmh-ai-gold), var(--pmh-ai-gold2));
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
    z-index: 1;
    position: relative;
}

.pmh-ai-signin-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(185, 138, 47, 0.25);
}

.pmh-ai-signin-btn:active {
    transform: translateY(0);
}

/* Sign in + site visit, stacked so the visit CTA sits directly below Sign in */
.pmh-ai-signin-actions {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    z-index: 1;
}

/* Separate "Book a site visit" section under the sign-in bar */
.pmh-ai-visit-bar {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 10px;
    margin-left: 0;
    margin-right: 0;
    padding: 10px 14px;   /* Equal 14px on both sides to match sign-in bar and chat */
    background: #fff;
    border: 1px solid rgba(185, 138, 47, .35);
    border-radius: 12px;
}

.pmh-ai-visit-bar[hidden] { display: none !important; }

.pmh-ai-visit-icon {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, var(--pmh-ai-gold, #b98a2f), var(--pmh-ai-gold2, #e0b25c));
}

.pmh-ai-visit-icon svg { width: 15px; height: 15px; }

.pmh-ai-visit-text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.pmh-ai-visit-text strong {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--charcoal, #373e4f);
}

.pmh-ai-visit-text small {
    font-size: 10.5px;
    color: var(--body-muted, #6d7998);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pmh-ai-visit-btn {
    flex: 0 0 auto;
    padding: 5px 11px;
    font-size: 11.5px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--pmh-ai-gold, #b98a2f), var(--pmh-ai-gold2, #e0b25c));
    border: none;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    transition: filter .2s ease, transform .2s ease;
}

.pmh-ai-visit-btn:hover { filter: brightness(1.05); transform: translateY(-1px); }

/* Mobile adjustments */
@media (max-width: 640px) {
    .pmh-ai-signin-bar {
        margin-top: 12px;
        margin-left: 0;
        margin-right: 0;
        padding: 10px 14px;   /* Equal 14px sides to match chat gutter */
        gap: 8px;
    }
    
    .pmh-ai-signin-icon {
        width: 17px;
        height: 17px;
    }
    
    .pmh-ai-signin-message {
        font-size: 12px;
    }
    
    .pmh-ai-signin-btn {
        padding: 5px 13px;
        font-size: 12px;
    }

    .pmh-ai-visit-bar {
        margin-top: 10px;
        margin-left: 0;
        margin-right: 0;
        padding: 10px 14px;   /* Equal 14px sides to match sign-in bar and chat */
        gap: 9px;
    }
}

