/* =============================================================
   CNM AI Search — Yacht Advisor Chat Widget
   Clean maritime precision • DM Sans • warm canvas palette
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600;700&family=Manrope:wght@400;500;600;700&display=swap');

/* ── Tokens ─────────────────────────────────────────────────── */
:root {
    /* Core palette */
    --c-navy:        #0B1929;   /* bubble trigger */
    --c-navy-2:      #162840;
    --c-blue:        #0057E7;   /* user bubble + accent */
    --c-blue-dk:     #0042BB;
    --c-blue-bg:     #EBF1FD;   /* chip fill hover */

    /* Surfaces */
    --c-bg:          #FFFFFF;
    --c-area:        #F4F3EF;   /* messages canvas — warm parchment */
    --c-bot:         #ECEAE6;   /* bot bubble */
    --c-bot-text:    #1A1918;
    --c-user-text:   #FFFFFF;

    /* UI chrome */
    --c-border:      #E6E4DF;
    --c-muted:       #9C9B93;
    --c-online:      #22C55E;
    --c-error:       #EF4444;
    --c-notification:#F02849;

    /* Shadows */
    --sh-xs:   0 1px 2px rgba(0,0,0,.05);
    --sh-sm:   0 2px 8px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
    --sh-md:   0 8px 24px rgba(0,0,0,.10), 0 2px 6px rgba(0,0,0,.05);
    --sh-lg:   0 20px 56px rgba(0,0,0,.13), 0 4px 14px rgba(0,0,0,.06);
    --sh-card: 0 2px 8px rgba(0,0,0,.06);
    --sh-card-hover: 0 8px 24px rgba(0,0,0,.12);

    /* Radii */
    --r-panel: 18px;
    --r-pill:  18px;
    --r-tail:  3px;
    --r-card:  12px;
    --r-full:  9999px;

    /* Motion */
    --ease-spring: cubic-bezier(.34,1.56,.64,1);
    --ease-out:    cubic-bezier(.16,1,.3,1);
    --ease-std:    cubic-bezier(.4,0,.2,1);

    /* Layout */
    --panel-w:  384px;
    --panel-h:  588px;
    --z:        999999;
}

/* ── Scoped reset ───────────────────────────────────────────── */
#cnm-ai-chat-root,
#cnm-ai-chat-root *,
#cnm-ai-chat-root *::before,
#cnm-ai-chat-root *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* =============================================================
   BUBBLE TRIGGER
   ============================================================= */
.cnm-ai-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: var(--z);
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--c-navy);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(11,25,41,.45), 0 1px 4px rgba(11,25,41,.25);
    transition:
        transform .22s var(--ease-spring),
        box-shadow .22s var(--ease-std);
    color: #fff;
    /* Pulse ring */
    outline: none;
}

.cnm-ai-bubble::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid rgba(11,25,41,.18);
    animation: cnmRing 2.8s ease-in-out infinite;
    pointer-events: none;
}

@keyframes cnmRing {
    0%, 100% { transform: scale(1);    opacity: .6; }
    50%       { transform: scale(1.12); opacity: 0;  }
}

.cnm-ai-bubble:hover {
    transform: scale(1.07) translateY(-1px);
    box-shadow: 0 8px 28px rgba(11,25,41,.50), 0 2px 8px rgba(11,25,41,.28);
}

.cnm-ai-bubble:active { transform: scale(.96); }

.cnm-ai-bubble.is-open { animation: none; }
.cnm-ai-bubble.is-open::before { display: none; }

/* Icon swap */
.cnm-ai-bubble svg {
    width: 22px;
    height: 22px;
    position: absolute;
    stroke: #fff;
    transition: opacity .2s var(--ease-std), transform .28s var(--ease-spring);
}

.cnm-ai-bubble .cnm-ai-bubble-icon { opacity: 1;  transform: scale(1)   rotate(0deg);  }
.cnm-ai-bubble .cnm-ai-close-icon  { opacity: 0;  transform: scale(.4)  rotate(-80deg); }

.cnm-ai-bubble.is-open .cnm-ai-bubble-icon { opacity: 0;  transform: scale(.4) rotate(80deg); }
.cnm-ai-bubble.is-open .cnm-ai-close-icon  { opacity: 1;  transform: scale(1)  rotate(0deg); }

/* Notification dot */
.cnm-ai-bubble::after {
    content: '';
    position: absolute;
    top: 3px;
    right: 3px;
    width: 12px;
    height: 12px;
    background: var(--c-notification);
    border-radius: 50%;
    border: 2px solid #fff;
    transition: transform .2s var(--ease-spring), opacity .2s;
}

.cnm-ai-bubble.is-open::after {
    opacity: 0;
    transform: scale(0);
}

/* =============================================================
   PANEL
   ============================================================= */
.cnm-ai-panel {
    position: fixed;
    bottom: 94px;
    right: 24px;
    z-index: var(--z);
    width: var(--panel-w);
    height: var(--panel-h);
    background: var(--c-bg);
    border-radius: var(--r-panel);
    box-shadow: var(--sh-lg);
    border: 1px solid var(--c-border);
    display: flex !important;   /* always flex so transitions work */
    flex-direction: column;
    overflow: hidden;
    /* Hidden state */
    opacity: 0;
    transform: translateY(12px) scale(.975);
    pointer-events: none;
    transition:
        opacity .26s var(--ease-std),
        transform .32s var(--ease-out);
}

.cnm-ai-panel:not([hidden]) {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Fullscreen */
.cnm-ai-panel.is-fullscreen {
    position: fixed;
    inset: 0;
    top: 5vh;
    bottom: 5vh;
    left: 50%;
    right: auto;
    transform: translateX(-50%) !important;
    width: min(640px, 92vw);
    height: auto;
    border-radius: var(--r-panel);
}

/* =============================================================
   HEADER
   ============================================================= */
.cnm-ai-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--c-bg);
    border-bottom: 1px solid var(--c-border);
    flex-shrink: 0;
}

.cnm-ai-header-title {
    display: flex;
    align-items: center;
    gap: 11px;
}

/* Avatar circle */
.cnm-ai-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--c-navy) 0%, #1e4080 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    box-shadow: var(--sh-sm);
}

/* Online dot */
.cnm-ai-avatar::after {
    content: '';
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 10px;
    height: 10px;
    background: var(--c-online);
    border-radius: 50%;
    border: 2px solid var(--c-bg);
}

.cnm-ai-avatar svg {
    width: 19px;
    height: 19px;
    fill: #fff;
}

.cnm-ai-header-title strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--c-bot-text);
    letter-spacing: -.01em;
    line-height: 1.2;
}

.cnm-ai-status {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11.5px;
    font-weight: 400;
    color: var(--c-online);
    margin-top: 2px;
}

.cnm-ai-status::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--c-online);
    display: block;
    flex-shrink: 0;
}

/* Action buttons */
.cnm-ai-header-actions {
    display: flex;
    gap: 2px;
}

.cnm-ai-icon-btn {
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-muted);
    transition: background .15s, color .15s, transform .12s;
}

.cnm-ai-icon-btn:hover {
    background: var(--c-area);
    color: var(--c-bot-text);
}

.cnm-ai-icon-btn:active { transform: scale(.9); }

.cnm-ai-icon-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cnm-ai-compress-icon { display: none; }
.cnm-ai-panel.is-fullscreen .cnm-ai-expand-icon   { display: none; }
.cnm-ai-panel.is-fullscreen .cnm-ai-compress-icon { display: block; }

/* =============================================================
   MESSAGES AREA
   ============================================================= */
.cnm-ai-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--c-area);
    scroll-behavior: smooth;
}

/* Fine scrollbar */
.cnm-ai-messages::-webkit-scrollbar { width: 3px; }
.cnm-ai-messages::-webkit-scrollbar-track { background: transparent; }
.cnm-ai-messages::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,.12);
    border-radius: 3px;
}
.cnm-ai-messages::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.2); }

/* =============================================================
   MESSAGE ROW
   ============================================================= */
.cnm-ai-msg {
    display: flex;
    flex-direction: column;
    max-width: 82%;
    animation: msgIn .24s var(--ease-out) both;
}

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

.cnm-ai-msg--bot  { align-self: flex-start; }
.cnm-ai-msg--user { align-self: flex-end; }

/* Bot layout: avatar + bubble in a row */
.cnm-ai-msg--bot {
    display: grid;
    grid-template-columns: 26px 1fr;
    grid-template-rows: 1fr auto;
    column-gap: 8px;
    row-gap: 2px;
}

/* Small avatar — bottom-aligned with bubble */
.cnm-ai-msg__avatar-sm {
    grid-column: 1;
    grid-row: 1;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--c-navy) 0%, #1e4080 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: flex-end;
    flex-shrink: 0;
    margin-bottom: 2px;
}

.cnm-ai-msg__avatar-sm svg {
    width: 13px;
    height: 13px;
    fill: #fff;
}

.cnm-ai-msg--bot .cnm-ai-msg__bubble { grid-column: 2; grid-row: 1; }
.cnm-ai-msg--bot .cnm-ai-msg__time   { grid-column: 2; grid-row: 2; }
.cnm-ai-msg--user .cnm-ai-msg__avatar-sm { display: none; }

/* =============================================================
   BUBBLES
   ============================================================= */
.cnm-ai-msg__bubble {
    padding: 10px 14px;
    border-radius: var(--r-pill);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.55;
    word-break: break-word;
    letter-spacing: -.005em;
}

/* Bot bubble — warm gray, tail bottom-left */
.cnm-ai-msg--bot .cnm-ai-msg__bubble {
    background: var(--c-bot);
    color: var(--c-bot-text);
    border-bottom-left-radius: var(--r-tail);
}

/* User bubble — quality blue, tail bottom-right */
.cnm-ai-msg--user .cnm-ai-msg__bubble {
    background: var(--c-blue);
    color: var(--c-user-text);
    border-bottom-right-radius: var(--r-tail);
    box-shadow: 0 2px 8px rgba(0,87,231,.3);
}

/* Links inside bubbles */
.cnm-ai-msg__bubble a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: rgba(currentcolor, .45);
    text-underline-offset: 2px;
    font-weight: 500;
    transition: opacity .15s;
}
.cnm-ai-msg__bubble a:hover { opacity: .75; }

/* Timestamps */
.cnm-ai-msg__time {
    font-size: 10.5px;
    font-weight: 400;
    color: var(--c-muted);
    padding: 2px 2px 0;
    letter-spacing: .01em;
}
.cnm-ai-msg--user .cnm-ai-msg__time { text-align: right; }

/* =============================================================
   TYPING INDICATOR
   ============================================================= */
.cnm-ai-typing {
    display: flex;
    align-items: center;
    padding: 6px 16px 4px;
    padding-left: 50px;   /* align with bubble column: 26px avatar + 8px gap + 16px offset */
    background: var(--c-area);
    flex-shrink: 0;
}

.cnm-ai-typing[hidden] { display: none !important; }

.cnm-ai-typing-bubble {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--c-bot);
    border-radius: var(--r-pill);
    border-bottom-left-radius: var(--r-tail);
    padding: 10px 14px;
    animation: msgIn .2s var(--ease-out) both;
}

.cnm-ai-typing-bubble span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--c-muted);
    animation: dot 1.3s ease-in-out infinite;
    display: block;
}
.cnm-ai-typing-bubble span:nth-child(2) { animation-delay: .16s; }
.cnm-ai-typing-bubble span:nth-child(3) { animation-delay: .32s; }

@keyframes dot {
    0%, 56%, 100% { transform: translateY(0);    opacity: .4; }
    28%           { transform: translateY(-5px);  opacity: 1;  }
}

/* =============================================================
   BOAT CARDS
   ============================================================= */
.cnm-ai-boats-wrap {
    align-self: stretch;
    margin-top: 6px;
    animation: msgIn .28s var(--ease-out) .08s both;
}

.cnm-ai-boats-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--c-muted);
    margin-bottom: 10px;
    padding-left: 2px;
}

/* Scroll rail */
.cnm-ai-boat-grid {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: visible;
    padding-bottom: 6px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.cnm-ai-boat-grid::-webkit-scrollbar { display: none; }

/* Card */
.cnm-ai-boat-card {
    flex: 0 0 168px;
    border-radius: var(--r-card);
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    overflow: hidden;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    scroll-snap-align: start;
    box-shadow: var(--sh-card);
    transition:
        transform .22s var(--ease-spring),
        box-shadow .22s var(--ease-std),
        border-color .15s;
}

.cnm-ai-boat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--sh-card-hover);
    border-color: rgba(0,87,231,.2);
}

/* Image */
.cnm-ai-boat-img {
    width: 100%;
    height: 106px;
    background-size: cover;
    background-position: center;
    background-color: #D8D6D1;
    flex-shrink: 0;
}

.cnm-ai-boat-img--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, var(--c-navy) 0%, #1e4080 100%);
}

.cnm-ai-boat-img--placeholder svg {
    width: 32px;
    height: 32px;
    stroke: rgba(255,255,255,.35);
    fill: none;
}

/* Card info */
.cnm-ai-boat-info {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
}

.cnm-ai-boat-sub {
    font-size: 9.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--c-muted);
}

.cnm-ai-boat-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--c-bot-text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    letter-spacing: -.01em;
}

.cnm-ai-boat-price {
    font-size: 13px;
    font-weight: 600;
    color: var(--c-blue);
    margin-top: 4px;
    letter-spacing: -.015em;
}

.cnm-ai-boat-location {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    color: var(--c-muted);
    margin-top: auto;
    padding-top: 6px;
}

.cnm-ai-pin-icon { display: flex; flex-shrink: 0; }
.cnm-ai-pin-icon svg {
    width: 10px;
    height: 10px;
    stroke: var(--c-muted);
}

/* =============================================================
   SUGGESTION CHIPS
   ============================================================= */
.cnm-ai-chips-wrap {
    align-self: stretch;
    margin-top: 4px;
    animation: msgIn .22s var(--ease-out) .1s both;
}

.cnm-ai-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cnm-ai-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: var(--r-full);
    border: 1.5px solid var(--c-blue);
    background: transparent;
    color: var(--c-blue);
    font-size: 12.5px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s, color .15s, transform .12s, box-shadow .15s;
    white-space: nowrap;
    letter-spacing: -.005em;
}

.cnm-ai-chip:hover {
    background: var(--c-blue);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0,87,231,.28);
}

.cnm-ai-chip:active { transform: scale(.97); }

/* =============================================================
   INPUT BAR
   ============================================================= */
.cnm-ai-input-bar {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 14px;
    background: var(--c-bg);
    border-top: 1px solid var(--c-border);
    flex-shrink: 0;
}

.cnm-ai-input {
    flex: 1;
    border: none;
    outline: none;
    border-radius: var(--r-full);
    padding: 10px 16px;
    font-size: 14px;
    font-family: inherit;
    font-weight: 400;
    letter-spacing: -.005em;
    color: var(--c-bot-text);
    background: var(--c-area);
    resize: none;
    line-height: 1.5;
    max-height: 120px;
    overflow-y: auto;
    transition: background .15s;
    /* Remove default textarea styling */
    -webkit-appearance: none;
}

.cnm-ai-input::placeholder {
    color: var(--c-muted);
    font-weight: 400;
}

.cnm-ai-input:focus {
    background: #EDECEA;
}

.cnm-ai-input::-webkit-scrollbar { width: 3px; }
.cnm-ai-input::-webkit-scrollbar-thumb { background: rgba(0,0,0,.12); border-radius: 3px; }

/* Circle send button */
.cnm-ai-send-btn {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: var(--c-blue);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,87,231,.35);
    transition:
        transform .18s var(--ease-spring),
        background .15s,
        box-shadow .18s,
        opacity .15s;
}

.cnm-ai-send-btn svg {
    width: 16px;
    height: 16px;
    stroke: #fff;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    margin-left: 1px; /* optical center for send arrow */
}

.cnm-ai-send-btn:hover {
    background: var(--c-blue-dk);
    transform: scale(1.08);
    box-shadow: 0 4px 14px rgba(0,87,231,.4);
}

.cnm-ai-send-btn:active  { transform: scale(.93); }

.cnm-ai-send-btn:disabled {
    opacity: .3;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* =============================================================
   FOOTER NOTE
   ============================================================= */
.cnm-ai-footer-note {
    text-align: center;
    font-size: 10px;
    font-weight: 400;
    color: var(--c-muted);
    letter-spacing: .03em;
    padding: 5px 16px 9px;
    background: var(--c-bg);
}

/* =============================================================
   BACKDROP
   ============================================================= */
.cnm-ai-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(11,25,41,.5);
    z-index: calc(var(--z) - 1);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn .22s var(--ease-std);
}

.cnm-ai-backdrop[hidden] { display: none !important; }

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* =============================================================
   RESPONSIVE — Mobile sheet
   ============================================================= */
@media (max-width: 480px) {
    .cnm-ai-bubble {
        bottom: 16px;
        right: 16px;
        width: 54px;
        height: 54px;
    }

    .cnm-ai-panel {
        right: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        width: 100% !important;
        height: 88vh !important;
        border-radius: 20px 20px 0 0 !important;
        border-bottom: none !important;
        transform: translateY(20px) !important;
    }

    .cnm-ai-panel:not([hidden]) {
        transform: translateY(0) !important;
    }

    .cnm-ai-panel.is-fullscreen {
        height: 100% !important;
        border-radius: 0 !important;
        transform: none !important;
    }

    .cnm-ai-messages { padding: 16px 14px 10px; }
    .cnm-ai-input-bar { padding: 10px 12px; }
    .cnm-ai-header { padding: 12px 14px; }
    .cnm-ai-typing { padding-left: 48px; }
}

@media (max-width: 360px) {
    .cnm-ai-header-title strong { font-size: 13px; }
    .cnm-ai-msg__bubble { font-size: 13.5px; }
    .cnm-ai-boat-card { flex: 0 0 152px; }
}

/* =============================================================
   Premium Redesign Override
   ============================================================= */

:root {
    --cnm-font-sans: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --cnm-font-serif: "Cormorant Garamond", Georgia, serif;
    --cnm-ink: #08243b;
    --cnm-ink-soft: #123a5b;
    --cnm-sea: #1f5f86;
    --cnm-sea-bright: #3f87b4;
    --cnm-sand: #f4ede2;
    --cnm-shell: #fcfaf6;
    --cnm-gold: #c3a46d;
    --cnm-gold-soft: rgba(195, 164, 109, 0.16);
    --cnm-border-soft: rgba(8, 36, 59, 0.1);
    --cnm-muted: #6d7b85;
    --cnm-shadow-panel: 0 28px 70px rgba(5, 26, 43, 0.28);
    --cnm-shadow-card: 0 16px 32px rgba(8, 36, 59, 0.12);
}

#cnm-ai-chat-root,
#cnm-ai-chat-root * ,
#cnm-ai-chat-root *::before,
#cnm-ai-chat-root *::after {
    font-family: var(--cnm-font-sans);
}

.cnm-ai-bubble {
    width: 68px;
    height: 68px;
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,.18);
    background:
        radial-gradient(circle at 28% 24%, rgba(255,255,255,.24), transparent 34%),
        linear-gradient(145deg, #0a2943 0%, #16486d 58%, #2a739d 100%);
    box-shadow: 0 22px 44px rgba(8,36,59,.34), inset 0 1px 0 rgba(255,255,255,.18);
}

.cnm-ai-bubble::before {
    inset: -8px;
    border-radius: 28px;
    border-color: rgba(31,95,134,.22);
}

.cnm-ai-bubble::after {
    top: 8px;
    right: 8px;
    background: linear-gradient(180deg, #ffce73 0%, #e5a128 100%);
    box-shadow: 0 0 0 3px rgba(8,36,59,.18);
}

.cnm-ai-panel {
    width: min(420px, calc(100vw - 28px));
    height: min(640px, calc(100vh - 112px));
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,.18);
    background:
        linear-gradient(180deg, #08243b 0, #123a5b 102px, #fbf8f2 102px, #fbf8f2 100%);
    box-shadow: var(--cnm-shadow-panel);
    isolation: isolate;
}

.cnm-ai-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top right, rgba(195,164,109,.18), transparent 28%),
        linear-gradient(180deg, rgba(255,255,255,.08), transparent 20%);
    pointer-events: none;
    z-index: 0;
}

.cnm-ai-panel-glow {
    position: absolute;
    inset: 12px 12px auto;
    height: 86px;
    border-radius: 18px;
    background:
        radial-gradient(circle at left top, rgba(255,255,255,.16), transparent 34%),
        linear-gradient(120deg, rgba(255,255,255,.06), rgba(255,255,255,0));
    border: 1px solid rgba(255,255,255,.08);
    z-index: 0;
    pointer-events: none;
}

.cnm-ai-panel.is-fullscreen {
    top: 20px;
    right: 20px;
    bottom: 20px;
    width: min(760px, calc(100vw - 40px));
    height: auto;
    border-radius: 26px;
}

.cnm-ai-header,
.cnm-ai-stage,
.cnm-ai-input-bar,
.cnm-ai-footer-note {
    position: relative;
    z-index: 1;
}

.cnm-ai-header {
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px 12px;
    background: transparent;
    border-bottom: 0;
}

.cnm-ai-header-title {
    flex: 1 1 auto;
    min-width: 0;
}

.cnm-ai-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background:
        radial-gradient(circle at 30% 25%, rgba(255,255,255,.22), transparent 34%),
        linear-gradient(145deg, rgba(255,255,255,.16), rgba(255,255,255,.06));
    border: 1px solid rgba(255,255,255,.16);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}

.cnm-ai-avatar::after {
    right: -2px;
    bottom: -2px;
    border-color: #0f324f;
}

.cnm-ai-title-copy {
    min-width: 0;
}

.cnm-ai-kicker {
    display: inline-block;
    margin-bottom: 3px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: rgba(255,255,255,.68);
}

.cnm-ai-header-title strong {
    display: block;
    font-family: var(--cnm-font-sans);
    font-size: clamp(20px, 2.1vw, 28px);
    font-weight: 700;
    line-height: .98;
    letter-spacing: -.03em;
    color: #fff;
}

.cnm-ai-status-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.cnm-ai-status,
.cnm-ai-header-note {
    min-height: 24px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.cnm-ai-status {
    background: rgba(255,255,255,.14);
    color: rgba(255,255,255,.94);
    border: 1px solid rgba(255,255,255,.12);
}

.cnm-ai-status::before {
    background: #6ed39f;
}

.cnm-ai-header-note {
    display: inline-flex;
    align-items: center;
    background: rgba(195,164,109,.14);
    color: rgba(255,245,226,.92);
    border: 1px solid rgba(195,164,109,.24);
}

.cnm-ai-header-actions {
    gap: 6px;
    flex-shrink: 0;
}

.cnm-ai-icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.1);
    color: rgba(255,255,255,.88);
    backdrop-filter: blur(10px);
}

.cnm-ai-stage {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    padding: 0 12px 0;
}

.cnm-ai-stage-intro {
    flex-shrink: 0;
    margin: 0 4px 8px;
    padding: 2px 2px 10px;
    border-radius: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    transform: none;
}

.cnm-ai-stage-intro__eyebrow {
    display: inline-block;
    margin-bottom: 4px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--cnm-sea);
}

.cnm-ai-stage-intro p {
    font-size: 12px;
    line-height: 1.45;
    color: var(--cnm-muted);
}

.cnm-ai-messages {
    flex: 1 1 auto;
    min-height: 0;
    gap: 10px;
    padding: 12px 10px 14px;
    border-radius: 20px;
    border: 1px solid rgba(18,58,91,.08);
    background:
        radial-gradient(circle at 100% 0, rgba(195,164,109,.12), transparent 26%),
        linear-gradient(180deg, rgba(255,255,255,.42), rgba(255,255,255,.08) 68px),
        linear-gradient(180deg, #f7f2e8 0%, #f1ebe1 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.55);
}

.cnm-ai-msg {
    max-width: min(88%, 420px);
}

.cnm-ai-msg--bot {
    grid-template-columns: 30px 1fr;
    gap: 6px 10px;
}

.cnm-ai-msg__avatar-sm {
    width: 30px;
    height: 30px;
    border-radius: 12px;
    background: linear-gradient(160deg, #0c2c47 0%, #1e5f83 100%);
    box-shadow: 0 8px 18px rgba(8,36,59,.18);
}

.cnm-ai-msg__bubble {
    padding: 12px 14px;
    border-radius: 20px;
    font-size: 13.5px;
    line-height: 1.55;
}

.cnm-ai-msg--bot .cnm-ai-msg__bubble {
    background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(252,248,241,.94));
    border: 1px solid rgba(18,58,91,.09);
    box-shadow: 0 8px 18px rgba(8,36,59,.08);
    color: var(--cnm-ink);
    border-bottom-left-radius: 9px;
}

.cnm-ai-msg--user .cnm-ai-msg__bubble {
    background:
        radial-gradient(circle at top left, rgba(255,255,255,.18), transparent 28%),
        linear-gradient(145deg, #123a5b 0%, #0a2c45 100%);
    box-shadow: 0 18px 28px rgba(8,36,59,.2);
    border-bottom-right-radius: 9px;
}

.cnm-ai-msg__time {
    font-size: 10px;
    color: #8b9aa4;
}

.cnm-ai-typing {
    padding: 0 8px 12px 44px;
    background: transparent;
}

.cnm-ai-typing-bubble {
    padding: 10px 12px;
    border-radius: 20px;
    border-bottom-left-radius: 9px;
    background: rgba(255,255,255,.9);
    border: 1px solid rgba(18,58,91,.09);
    box-shadow: 0 8px 18px rgba(8,36,59,.08);
}

.cnm-ai-chips {
    gap: 6px;
}

.cnm-ai-chip {
    min-height: 34px;
    padding: 7px 11px;
    border-radius: 999px;
    border: 1px solid rgba(18,58,91,.16);
    background: rgba(255,255,255,.74);
    color: var(--cnm-ink);
    font-size: 11.5px;
    font-weight: 600;
    box-shadow: 0 6px 14px rgba(8,36,59,.06);
}

.cnm-ai-chip:hover {
    background: linear-gradient(145deg, #123a5b 0%, #1e5f83 100%);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 12px 20px rgba(8,36,59,.12);
}

.cnm-ai-boats-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--cnm-muted);
}

.cnm-ai-boat-grid {
    gap: 12px;
}

.cnm-ai-boat-card {
    flex: 0 0 214px;
    border-radius: 20px;
    border: 1px solid rgba(18,58,91,.1);
    background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(251,247,240,.96));
    box-shadow: var(--cnm-shadow-card);
}

.cnm-ai-boat-card:hover {
    border-color: rgba(31,95,134,.24);
    box-shadow: 0 22px 32px rgba(8,36,59,.14);
}

.cnm-ai-boat-img {
    height: 132px;
    background-color: #d9e6ec;
}

.cnm-ai-boat-img--placeholder {
    background:
        radial-gradient(circle at top left, rgba(255,255,255,.18), transparent 32%),
        linear-gradient(160deg, #123a5b 0%, #2b779c 100%);
}

.cnm-ai-boat-info {
    gap: 6px;
    padding: 14px 14px 15px;
}

.cnm-ai-boat-sub {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--cnm-sea);
}

.cnm-ai-boat-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--cnm-ink);
}

.cnm-ai-boat-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--cnm-sea);
}

.cnm-ai-boat-location {
    gap: 6px;
    font-size: 12px;
    color: var(--cnm-muted);
}

.cnm-ai-input-bar {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px 10px;
    background: linear-gradient(180deg, rgba(255,255,255,.72), #fff 32%);
    border-top: 1px solid rgba(18,58,91,.08);
}

.cnm-ai-input-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 0;
}

.cnm-ai-input-label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--cnm-ink);
}

.cnm-ai-input-subtle {
    font-size: 11px;
    line-height: 1.35;
    color: var(--cnm-muted);
}

.cnm-ai-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    width: 100%;
    min-width: 0;
    padding: 8px 10px 8px 12px;
    border-radius: 18px;
    border: 1px solid rgba(18,58,91,.12);
    background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(250,248,244,.96));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 8px 18px rgba(8,36,59,.07);
}

.cnm-ai-input {
    flex: 1 1 auto;
    width: 100%;
    min-height: 20px;
    padding: 3px 0 0;
    background: transparent;
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.45;
}

.cnm-ai-input::placeholder {
    color: #93a0a9;
}

.cnm-ai-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    background:
        radial-gradient(circle at 26% 24%, rgba(255,255,255,.18), transparent 28%),
        linear-gradient(150deg, #123a5b 0%, #2b779c 100%);
    box-shadow: 0 12px 22px rgba(18,58,91,.18);
}

.cnm-ai-footer-note {
    padding: 0 14px 12px;
    font-size: 10px;
    line-height: 1.4;
    color: var(--cnm-muted);
    background: #fff;
}

.cnm-ai-backdrop {
    background: rgba(7,25,39,.48);
    backdrop-filter: blur(6px);
}

@media (max-width: 767px) {
    .cnm-ai-bubble {
        right: 18px;
        bottom: 18px;
        width: 62px;
        height: 62px;
        border-radius: 22px;
    }

    .cnm-ai-panel,
    .cnm-ai-panel.is-fullscreen {
        right: 12px !important;
        left: 12px !important;
        width: auto !important;
    }

    .cnm-ai-panel {
        bottom: 92px !important;
        height: min(78vh, 620px) !important;
    }

    .cnm-ai-panel.is-fullscreen {
        top: 12px !important;
        bottom: 12px !important;
        border-radius: 28px !important;
    }

    .cnm-ai-header {
        padding: 14px 14px 12px !important;
    }

    .cnm-ai-header-title strong {
        font-size: 22px;
    }

    .cnm-ai-header-note {
        display: none;
    }

    .cnm-ai-stage {
        padding: 0 10px 0;
    }

    .cnm-ai-stage-intro {
        margin: 0 2px 8px;
    }

    .cnm-ai-messages {
        padding: 10px 8px 12px !important;
    }

    .cnm-ai-input-bar {
        padding: 10px 12px 10px !important;
    }
}

@media (max-width: 560px) {
    .cnm-ai-panel {
        right: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 84vh !important;
        border-radius: 22px 22px 0 0 !important;
    }

    .cnm-ai-panel.is-fullscreen {
        inset: 0 !important;
        border-radius: 0 !important;
    }

    .cnm-ai-header {
        padding: 14px 14px 12px !important;
    }

    .cnm-ai-header-title strong {
        font-size: 20px;
    }

    .cnm-ai-stage {
        padding: 0 10px 0;
    }

    .cnm-ai-stage-intro {
        margin: 0 2px 8px;
        padding: 2px 0 8px;
    }

    .cnm-ai-messages {
        padding: 10px 8px 12px !important;
    }

    .cnm-ai-msg {
        max-width: 92%;
    }

    .cnm-ai-input-bar {
        padding: 10px 12px 10px !important;
    }

    .cnm-ai-send-btn {
        width: 38px;
        height: 38px;
        border-radius: 14px;
    }
}

@media (max-width: 400px) {
    .cnm-ai-header-title strong {
        font-size: 18px;
    }

    .cnm-ai-header-note {
        display: none;
    }

    .cnm-ai-input-subtle {
        display: none;
    }

    .cnm-ai-boat-card {
        flex-basis: 196px;
    }
}
