:root {
    --aimee-blue: #2563eb;
    --aimee-blue-dark: #1d4ed8;
    --aimee-ink: #0f172a;
    --aimee-muted: #64748b;
    --aimee-line: #e2e8f0;
    --aimee-surface: #ffffff;
    --aimee-soft: #f8fafc;
    --aimee-success: #059669;
    --aimee-warning: #d97706;
}

.imotive-aimee-launcher {
    position: fixed;
    right: 22px;
    bottom: max(22px, env(safe-area-inset-bottom));
    z-index: 2147482000;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 58px;
    padding: 8px 16px 8px 8px;
    border: 1px solid rgba(148, 163, 184, .28);
    border-radius: 999px;
    background: rgba(255, 255, 255, .94);
    color: var(--aimee-ink);
    box-shadow: 0 18px 55px rgba(15, 23, 42, .18), 0 3px 12px rgba(15, 23, 42, .08);
    backdrop-filter: blur(18px) saturate(150%);
    font: 500 14px/1.25 Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.imotive-aimee-launcher:hover { transform: translateY(-2px); border-color: rgba(37, 99, 235, .35); box-shadow: 0 22px 62px rgba(15, 23, 42, .22); }
.imotive-aimee-launcher:focus-visible { outline: 3px solid rgba(37, 99, 235, .28); outline-offset: 3px; }
.imotive-aimee-launcher-copy { display: grid; text-align: left; }
.imotive-aimee-launcher-copy strong { font-size: 13px; letter-spacing: -.01em; }
.imotive-aimee-launcher-copy small { color: var(--aimee-muted); font-size: 10px; font-weight: 600; }

.imotive-aimee-orb {
    position: relative;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    overflow: hidden;
    border-radius: 50%;
    color: #fff;
    background:
        radial-gradient(circle at 70% 25%, rgba(255,255,255,.5), transparent 18%),
        linear-gradient(145deg, #60a5fa 0%, #2563eb 45%, #312e81 100%);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.28), 0 8px 22px rgba(37, 99, 235, .28);
}
.imotive-aimee-orb::before {
    content: "";
    position: absolute;
    inset: -45%;
    background: conic-gradient(from 90deg, transparent, rgba(255,255,255,.42), transparent 38%);
    animation: imotive-aimee-spin 6s linear infinite;
}
.imotive-aimee-orb span { position: relative; z-index: 1; font: 800 13px/1 Inter, sans-serif; letter-spacing: -.06em; }
.imotive-aimee-orb.is-small { width: 38px; height: 38px; flex-basis: 38px; }
@keyframes imotive-aimee-spin { to { transform: rotate(360deg); } }

.imotive-aimee-panel[hidden] { display: none !important; }
.imotive-aimee-panel {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.imotive-aimee-panel.is-open { opacity: 1; pointer-events: auto; }
.imotive-aimee-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .28); backdrop-filter: blur(4px); }
.imotive-aimee-window {
    position: absolute;
    right: 20px;
    bottom: 20px;
    display: grid;
    grid-template-rows: auto auto minmax(240px, 1fr) auto auto auto;
    width: min(430px, calc(100vw - 32px));
    height: min(720px, calc(100dvh - 40px));
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, .35);
    border-radius: 24px;
    background: rgba(255,255,255,.98);
    color: var(--aimee-ink);
    box-shadow: 0 30px 90px rgba(15, 23, 42, .3);
    transform: translateY(18px) scale(.98);
    transform-origin: bottom right;
    transition: transform .22s cubic-bezier(.2,.8,.2,1), width .25s ease, height .25s ease, border-radius .25s ease;
}
.imotive-aimee-panel.is-open .imotive-aimee-window { transform: translateY(0) scale(1); }
.imotive-aimee-panel.is-desk .imotive-aimee-window {
    inset: 18px;
    width: auto;
    height: auto;
    border-radius: 20px;
    transform-origin: center;
    grid-template-columns: minmax(260px, .58fr) minmax(460px, 1.42fr);
    grid-template-rows: auto auto 1fr auto auto;
}
.imotive-aimee-panel.is-desk .imotive-aimee-header { grid-column: 1 / -1; }
.imotive-aimee-panel.is-desk .imotive-aimee-context { grid-column: 1 / -1; }
.imotive-aimee-panel.is-desk .imotive-aimee-messages { grid-column: 2; grid-row: 3; padding: 34px max(34px, 7vw); }
.imotive-aimee-panel.is-desk .imotive-aimee-prompts { grid-column: 1; grid-row: 3 / 5; align-content: start; padding: 32px; border-right: 1px solid var(--aimee-line); background: var(--aimee-soft); }
.imotive-aimee-panel.is-desk .imotive-aimee-prompts::before { content: "Reception shortcuts"; display: block; margin-bottom: 15px; color: var(--aimee-muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.imotive-aimee-panel.is-desk .imotive-aimee-prompts button { width: 100%; justify-content: flex-start; padding: 14px 16px; background: #fff; }
.imotive-aimee-panel.is-desk .imotive-aimee-compose { grid-column: 2; grid-row: 4; margin: 0 max(34px, 7vw) 16px; }
.imotive-aimee-panel.is-desk .imotive-aimee-footer { grid-column: 1 / -1; grid-row: 5; }

.imotive-aimee-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    min-height: 72px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--aimee-line);
    background: rgba(255,255,255,.93);
}
.imotive-aimee-identity { display: flex; align-items: center; gap: 11px; min-width: 0; }
.imotive-aimee-identity h2 { margin: 0; color: var(--aimee-ink); font-size: 16px; font-weight: 800; letter-spacing: -.025em; }
.imotive-aimee-identity p { margin: 2px 0 0; color: var(--aimee-muted); font-size: 10px; font-weight: 650; }
.imotive-aimee-header-actions { display: flex; gap: 4px; }
.imotive-aimee-icon-button {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--aimee-muted);
    font: 700 19px/1 system-ui, sans-serif;
    cursor: pointer;
}
.imotive-aimee-icon-button:hover, .imotive-aimee-icon-button.is-active { color: var(--aimee-blue); background: #eff6ff; }
.imotive-aimee-icon-button:focus-visible { outline: 2px solid var(--aimee-blue); outline-offset: 1px; }

.imotive-aimee-context {
    padding: 8px 16px;
    border-bottom: 1px solid var(--aimee-line);
    background: #f8fafc;
    color: var(--aimee-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: capitalize;
}
.imotive-aimee-messages {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 20px 16px 12px;
    scroll-behavior: smooth;
}
.imotive-aimee-message { display: flex; align-items: flex-end; gap: 8px; margin: 0 0 14px; }
.imotive-aimee-message.is-user { justify-content: flex-end; }
.imotive-aimee-message-avatar {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-radius: 9px;
    background: #e0e7ff;
    color: #3730a3;
    font-size: 9px;
    font-weight: 850;
}
.imotive-aimee-message.is-user .imotive-aimee-message-avatar { order: 2; background: #e2e8f0; color: #475569; }
.imotive-aimee-bubble {
    max-width: 82%;
    padding: 11px 13px;
    border: 1px solid var(--aimee-line);
    border-radius: 16px 16px 16px 5px;
    background: #fff;
    box-shadow: 0 3px 12px rgba(15, 23, 42, .045);
}
.imotive-aimee-message.is-user .imotive-aimee-bubble { border-color: var(--aimee-blue); border-radius: 16px 16px 5px 16px; background: var(--aimee-blue); color: #fff; }
.imotive-aimee-bubble p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.55; }
.imotive-aimee-status { margin: 4px 0 14px 36px; color: var(--aimee-muted); font-size: 11px; font-weight: 650; }
.imotive-aimee-status::after { content: ""; display: inline-block; width: 16px; height: 4px; margin-left: 6px; border-radius: 999px; background: linear-gradient(90deg, var(--aimee-blue) 30%, #bfdbfe 30% 65%, #dbeafe 65%); background-size: 200% 100%; animation: imotive-aimee-loading 1s linear infinite; vertical-align: middle; }
@keyframes imotive-aimee-loading { to { background-position: -200% 0; } }
.imotive-aimee-notice { margin: 10px 0 14px 36px; padding: 10px 12px; border: 1px solid #fed7aa; border-radius: 12px; background: #fff7ed; color: #9a3412; font-size: 11px; line-height: 1.45; }

.imotive-aimee-action-card {
    margin: 10px 4px 18px 36px;
    padding: 14px;
    border: 1px solid #bfdbfe;
    border-radius: 16px;
    background: linear-gradient(145deg, #eff6ff, #fff);
    box-shadow: 0 8px 24px rgba(37, 99, 235, .08);
}
.imotive-aimee-action-card.is-complete { border-color: #a7f3d0; background: #ecfdf5; color: #065f46; }
.imotive-aimee-action-eyebrow { display: block; margin-bottom: 6px; color: var(--aimee-blue); font-size: 9px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.imotive-aimee-action-card p { margin: 0; font-size: 12px; line-height: 1.5; }
.imotive-aimee-action-buttons { display: flex; gap: 8px; margin-top: 12px; }
.imotive-aimee-action-buttons button { min-height: 34px; padding: 7px 12px; border-radius: 10px; font: 750 11px/1 Inter, sans-serif; cursor: pointer; }
.imotive-aimee-action-buttons .is-confirm { border: 1px solid var(--aimee-blue); background: var(--aimee-blue); color: #fff; }
.imotive-aimee-action-buttons .is-confirm:hover { background: var(--aimee-blue-dark); }
.imotive-aimee-action-buttons .is-cancel { border: 1px solid var(--aimee-line); background: #fff; color: var(--aimee-ink); }
.imotive-aimee-action-buttons button:disabled { cursor: wait; opacity: .62; }

.imotive-aimee-prompts {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding: 8px 16px 12px;
    scrollbar-width: none;
}
.imotive-aimee-prompts::-webkit-scrollbar { display: none; }
.imotive-aimee-prompts button {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    min-height: 30px;
    padding: 6px 10px;
    border: 1px solid var(--aimee-line);
    border-radius: 999px;
    background: #fff;
    color: #334155;
    font: 700 10px/1.2 Inter, sans-serif;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.imotive-aimee-prompts button:hover { border-color: #93c5fd; background: #eff6ff; color: #1d4ed8; }

.imotive-aimee-compose {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 38px 38px;
    align-items: end;
    gap: 7px;
    margin: 0 12px 10px;
    padding: 6px;
    border: 1px solid var(--aimee-line);
    border-radius: 17px;
    background: #fff;
    box-shadow: 0 6px 20px rgba(15, 23, 42, .07);
}
.imotive-aimee-compose:focus-within { border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(37, 99, 235, .1), 0 6px 20px rgba(15, 23, 42, .07); }
.imotive-aimee-compose textarea {
    width: 100%;
    min-height: 36px;
    max-height: 132px;
    resize: none;
    box-sizing: border-box;
    padding: 8px 7px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--aimee-ink);
    font: 500 13px/1.45 Inter, sans-serif;
}
.imotive-aimee-compose textarea::placeholder { color: #94a3b8; }
.imotive-aimee-mic, .imotive-aimee-send {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 12px;
    cursor: pointer;
}
.imotive-aimee-mic { border: 0; background: #f1f5f9; color: #475569; }
.imotive-aimee-mic.is-listening { color: #fff; background: #dc2626; animation: imotive-aimee-pulse 1s ease-in-out infinite; }
@keyframes imotive-aimee-pulse { 50% { box-shadow: 0 0 0 7px rgba(220, 38, 38, .14); } }
.imotive-aimee-send { border: 1px solid var(--aimee-blue); background: var(--aimee-blue); color: #fff; font-size: 17px; }
.imotive-aimee-send:hover { background: var(--aimee-blue-dark); }
.imotive-aimee-send:disabled { opacity: .55; cursor: wait; }

.imotive-aimee-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 14px 10px;
    border-top: 1px solid #f1f5f9;
    color: #94a3b8;
    font-size: 8.5px;
    line-height: 1.35;
}
.imotive-aimee-footer a { color: #64748b; text-decoration: underline; }
.imotive-aimee-live-dot { width: 7px; height: 7px; margin-left: auto; border-radius: 50%; background: #10b981; box-shadow: 0 0 0 4px rgba(16,185,129,.12); }
.imotive-aimee-nav svg { color: var(--aimee-blue); }

html.imotive-aimee-open { overflow: hidden !important; }
.admin-bar .imotive-aimee-panel.is-desk .imotive-aimee-window { top: calc(18px + 32px); }

body.dark-mode .imotive-aimee-window,
body.dark-mode .imotive-aimee-header,
body.dark-mode .imotive-aimee-bubble,
body.dark-mode .imotive-aimee-compose,
body.dark-mode .imotive-aimee-prompts button { background: #18181b; color: #f8fafc; border-color: #3f3f46; }
body.dark-mode .imotive-aimee-context,
body.dark-mode .imotive-aimee-panel.is-desk .imotive-aimee-prompts { background: #101014; border-color: #27272a; }
body.dark-mode .imotive-aimee-identity h2,
body.dark-mode .imotive-aimee-compose textarea { color: #f8fafc; }
body.dark-mode .imotive-aimee-bubble { box-shadow: none; }
body.dark-mode .imotive-aimee-action-card { background: #172554; border-color: #1d4ed8; color: #dbeafe; }
body.dark-mode .imotive-aimee-action-buttons .is-cancel { background: #27272a; color: #f8fafc; border-color: #52525b; }

@media (max-width: 782px) {
    .admin-bar .imotive-aimee-panel.is-desk .imotive-aimee-window { top: calc(10px + 46px); }
}
@media (max-width: 720px) {
    .imotive-aimee-launcher { right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); min-height: 52px; padding-right: 11px; }
    .imotive-aimee-launcher-copy small { display: none; }
    .imotive-aimee-orb { width: 38px; height: 38px; flex-basis: 38px; }
    .imotive-aimee-window,
    .imotive-aimee-panel.is-desk .imotive-aimee-window {
        inset: auto 0 0;
        width: 100%;
        height: min(88dvh, 760px);
        border-width: 1px 0 0;
        border-radius: 22px 22px 0 0;
        grid-template-columns: 1fr;
        grid-template-rows: auto auto minmax(220px,1fr) auto auto auto;
    }
    .imotive-aimee-panel.is-desk .imotive-aimee-header,
    .imotive-aimee-panel.is-desk .imotive-aimee-context,
    .imotive-aimee-panel.is-desk .imotive-aimee-messages,
    .imotive-aimee-panel.is-desk .imotive-aimee-prompts,
    .imotive-aimee-panel.is-desk .imotive-aimee-compose,
    .imotive-aimee-panel.is-desk .imotive-aimee-footer { grid-column: 1; }
    .imotive-aimee-panel.is-desk .imotive-aimee-header { grid-row: 1; }
    .imotive-aimee-panel.is-desk .imotive-aimee-context { grid-row: 2; }
    .imotive-aimee-panel.is-desk .imotive-aimee-messages { grid-row: 3; padding: 18px 16px 10px; }
    .imotive-aimee-panel.is-desk .imotive-aimee-prompts { grid-row: 4; display: flex; padding: 8px 16px 12px; border: 0; background: transparent; }
    .imotive-aimee-panel.is-desk .imotive-aimee-prompts::before { display: none; }
    .imotive-aimee-panel.is-desk .imotive-aimee-prompts button { width: auto; padding: 6px 10px; }
    .imotive-aimee-panel.is-desk .imotive-aimee-compose { grid-row: 5; margin: 0 10px 8px; }
    .imotive-aimee-panel.is-desk .imotive-aimee-footer { grid-row: 6; }
    .imotive-aimee-header { padding: 11px 12px; }
    .imotive-aimee-icon-button[data-aimee-desk] { display: none; }
    .imotive-aimee-bubble { max-width: 88%; }
}

@media (prefers-reduced-motion: reduce) {
    .imotive-aimee-orb::before,
    .imotive-aimee-status::after,
    .imotive-aimee-mic.is-listening { animation: none !important; }
    .imotive-aimee-panel,
    .imotive-aimee-window,
    .imotive-aimee-launcher { transition: none !important; }
}

/* Model/year issue intelligence card */
.imotive-aimee-knowledge-card {
    margin: 4px 0 14px 38px;
    max-width: min(92%, 640px);
    padding: 14px;
    border: 1px solid #dbeafe;
    border-radius: 16px;
    background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
    box-shadow: 0 8px 24px rgba(15, 23, 42, .06);
    color: var(--aimee-ink);
}
.imotive-aimee-knowledge-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}
.imotive-aimee-knowledge-head h3 {
    margin: 1px 0 0;
    color: #0f172a;
    font: 750 15px/1.25 Inter, sans-serif;
}
.imotive-aimee-knowledge-eyebrow {
    display: block;
    color: #2563eb;
    font: 750 8px/1.2 Inter, sans-serif;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.imotive-aimee-knowledge-badge {
    flex: 0 0 auto;
    padding: 5px 8px;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font: 700 8px/1 Inter, sans-serif;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.imotive-aimee-knowledge-summary,
.imotive-aimee-knowledge-applicability,
.imotive-aimee-knowledge-sources {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
}
.imotive-aimee-knowledge-sources > strong {
    display: block;
    margin-bottom: 6px;
    color: #475569;
    font: 750 9px/1.2 Inter, sans-serif;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.imotive-aimee-knowledge-source-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.imotive-aimee-knowledge-source-links a {
    display: inline-flex;
    max-width: 100%;
    padding: 6px 8px;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font: 650 9px/1.2 Inter, sans-serif;
    text-decoration: none;
    overflow-wrap: anywhere;
}
.imotive-aimee-knowledge-source-links a:hover,
.imotive-aimee-knowledge-source-links a:focus-visible {
    border-color: #60a5fa;
    background: #dbeafe;
}
body.dark-mode .imotive-aimee-knowledge-sources { border-color: #3f3f46; }
body.dark-mode .imotive-aimee-knowledge-source-links a { background: #172554; border-color: #1d4ed8; color: #bfdbfe; }
.imotive-aimee-knowledge-foot {
    margin: 0;
    font: 500 11px/1.5 Inter, sans-serif;
}
.imotive-aimee-knowledge-summary { color: #334155; }
.imotive-aimee-knowledge-applicability {
    margin-top: 6px;
    padding: 7px 9px;
    border-radius: 9px;
    background: #f8fafc;
    color: #64748b;
}
.imotive-aimee-knowledge-issues {
    display: grid;
    gap: 7px;
    margin-top: 10px;
}
.imotive-aimee-knowledge-issue {
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 11px;
    background: #fff;
}
.imotive-aimee-knowledge-issue summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 10px;
    cursor: pointer;
    list-style: none;
    color: #1e293b;
    font: 700 11px/1.35 Inter, sans-serif;
}
.imotive-aimee-knowledge-issue summary::-webkit-details-marker { display: none; }
.imotive-aimee-knowledge-issue summary::after {
    content: '+';
    order: 3;
    color: #64748b;
    font-size: 15px;
    line-height: 1;
}
.imotive-aimee-knowledge-issue[open] summary::after { content: '−'; }
.imotive-aimee-knowledge-issue summary > span:first-child { flex: 1 1 auto; }
.imotive-aimee-knowledge-issue summary > span:nth-child(2) {
    flex: 0 0 auto;
    padding: 3px 6px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    font: 650 7.5px/1 Inter, sans-serif;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.imotive-aimee-knowledge-issue summary > span.is-high { background: #fff1f2; color: #be123c; }
.imotive-aimee-knowledge-issue summary > span.is-medium { background: #fffbeb; color: #b45309; }
.imotive-aimee-knowledge-issue summary > span.is-low { background: #ecfdf5; color: #047857; }
.imotive-aimee-knowledge-body {
    padding: 0 10px 10px;
    color: #475569;
    font: 500 10.5px/1.5 Inter, sans-serif;
}
.imotive-aimee-knowledge-body p { margin: 0 0 7px; }
.imotive-aimee-knowledge-body strong {
    display: block;
    margin-top: 7px;
    color: #334155;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.imotive-aimee-knowledge-body ul { margin: 4px 0 0 16px; padding: 0; }
.imotive-aimee-knowledge-body li { margin: 2px 0; }
.imotive-aimee-knowledge-applies { color: #64748b; font-style: italic; }
.imotive-aimee-knowledge-foot {
    margin-top: 10px;
    color: #94a3b8;
    font-size: 8.5px;
}
body.dark-mode .imotive-aimee-knowledge-card,
body.dark-mode .imotive-aimee-knowledge-issue { background: #18181b; border-color: #3f3f46; color: #f8fafc; }
body.dark-mode .imotive-aimee-knowledge-head h3,
body.dark-mode .imotive-aimee-knowledge-issue summary { color: #f8fafc; }
body.dark-mode .imotive-aimee-knowledge-summary,
body.dark-mode .imotive-aimee-knowledge-body { color: #cbd5e1; }
body.dark-mode .imotive-aimee-knowledge-applicability { background: #27272a; color: #a1a1aa; }
@media (max-width: 720px) {
    .imotive-aimee-knowledge-card { margin-left: 0; max-width: 100%; padding: 12px; }
    .imotive-aimee-knowledge-issue summary { align-items: flex-start; flex-wrap: wrap; }
}
