:root {
    --navy: #061725;
    --navy-2: #0a2332;
    --paper: #f3f6f4;
    --card: #ffffff;
    --ink: #0a1c25;
    --muted: #607078;
    --line: #d8e2df;
    --mint: #2bf0c5;
    --green: #12b994;
    --cyan: #31cad8;
    --amber: #e5a935;
    --red: #e35d62;
    --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: var(--sans); }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; }

.chat-header {
    min-height: 76px; padding: 0 max(24px, calc((100vw - 1320px) / 2)); display: flex; align-items: center; justify-content: space-between;
    color: #fff; background: var(--navy); border-bottom: 1px solid rgba(43,240,197,.16);
}
.chat-brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-size: 18px; font-weight: 700; letter-spacing: .2px; }
.chat-brand > span:first-child { width: 36px; height: 36px; display: grid; place-items: center; color: var(--mint); border: 1px solid rgba(43,240,197,.55); transform: rotate(45deg); }
.chat-brand > span:first-child::first-letter { transform: rotate(-45deg); }
.chat-brand > span:last-child, .chat-brand span { color: var(--mint); }
.chat-header nav { display: flex; gap: 22px; }
.chat-header nav a { color: #bfd0d4; text-decoration: none; font-size: 13px; }
.chat-header nav a:hover { color: var(--mint); }

.chat-page { min-height: calc(100vh - 76px); }
.joker-intro { min-height: 420px; display: grid; grid-template-columns: minmax(320px, .8fr) minmax(420px, 1.2fr); color: #fff; background: radial-gradient(circle at 78% 36%, rgba(27,185,163,.18), transparent 28%), var(--navy); overflow: hidden; }
.joker-portrait { min-height: 420px; position: relative; overflow: hidden; border-right: 1px solid rgba(43,240,197,.18); }
.joker-portrait::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 55%, var(--navy) 100%), linear-gradient(0deg, var(--navy) 0%, transparent 25%); pointer-events: none; }
.joker-portrait img { width: 100%; height: 100%; position: absolute; inset: 0; object-fit: cover; object-position: 50% 23%; filter: saturate(.92) contrast(1.03); }
.portrait-scan { width: 100%; height: 1px; position: absolute; z-index: 2; left: 0; top: 24%; background: linear-gradient(90deg, transparent, var(--mint), transparent); box-shadow: 0 0 18px var(--mint); opacity: .6; animation: scan 5s ease-in-out infinite; }
@keyframes scan { 0%,100% { transform: translateY(0); opacity: .1; } 50% { transform: translateY(280px); opacity: .75; } }
.joker-copy { max-width: 740px; padding: 76px 7vw 60px; align-self: center; }
.joker-kicker { display: flex; align-items: center; gap: 10px; color: #9eb7bd; font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; }
.joker-kicker span { width: 28px; height: 1px; background: var(--mint); box-shadow: 0 0 8px var(--mint); }
.joker-copy h1 { margin: 18px 0; font-family: var(--serif); font-size: clamp(52px, 7vw, 94px); font-weight: 600; line-height: .92; letter-spacing: -3px; }
.joker-copy h1 small { display: block; margin-bottom: 13px; color: #b4c5c9; font: 600 12px var(--sans); letter-spacing: 2px; text-transform: uppercase; }
.joker-copy h1 em { color: var(--mint); font-weight: 600; text-shadow: 0 0 30px rgba(43,240,197,.22); }
.joker-lead { max-width: 580px; color: #cfdddf; font-size: clamp(17px, 2vw, 22px); line-height: 1.55; }
.joker-principles { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 8px; }
.joker-principles span { padding: 8px 12px; color: #aeeadf; border: 1px solid rgba(43,240,197,.25); background: rgba(43,240,197,.06); font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; }
.ai-disclosure { max-width: 650px; margin: 28px 0 0; padding-left: 14px; color: #849da3; border-left: 2px solid rgba(43,240,197,.48); font-size: 12px; line-height: 1.6; }
.ai-disclosure strong { color: #bdd1d4; }

.chat-workspace { max-width: 1320px; margin: -34px auto 80px; padding: 0 24px; position: relative; z-index: 3; display: grid; grid-template-columns: 310px minmax(0, 1fr); align-items: start; gap: 18px; }
.vehicle-panel, .conversation-panel { background: var(--card); border: 1px solid var(--line); box-shadow: 0 20px 55px rgba(6,23,37,.10); }
.vehicle-panel { padding: 28px; }
.panel-heading { display: flex; align-items: center; gap: 13px; }
.panel-heading > span { width: 36px; height: 36px; display: grid; place-items: center; color: #0b6e61; border: 1px solid #84d8c8; border-radius: 50%; font-size: 11px; font-weight: 700; }
.panel-heading div { display: flex; flex-direction: column; }
.panel-heading small { color: #869596; font-size: 9px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; }
.panel-heading h2 { margin: 1px 0 0; font: 600 27px var(--serif); }
.vehicle-panel > p { margin: 18px 0 22px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.vehicle-panel label { margin: 15px 0 6px; display: block; color: #42565d; font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; }
.vehicle-panel label span { color: #91a0a4; font-weight: 500; text-transform: none; }
.vehicle-panel input, .vehicle-panel select { width: 100%; min-height: 44px; padding: 0 12px; color: var(--ink); background: #f8faf9; border: 1px solid #cfdbd8; border-radius: 0; outline: none; }
.vehicle-panel input:focus, .vehicle-panel select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(18,185,148,.1); }
.vehicle-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-switch { margin-bottom: 6px; display: grid; grid-template-columns: repeat(3, 1fr); background: #edf3f1; border: 1px solid #d4dfdc; }
.mode-switch button { min-height: 40px; padding: 8px; color: #5c6c70; background: transparent; border: 0; font-size: 11px; font-weight: 700; }
.mode-switch button[aria-pressed="true"] { color: #fff; background: var(--navy-2); box-shadow: inset 0 -2px var(--mint); }
.coverage-note { margin-top: 24px; padding: 15px; color: #b9cbcd; background: var(--navy-2); }
.coverage-note strong, .coverage-note span { display: block; }
.coverage-note strong { margin-bottom: 6px; color: var(--mint); font-size: 10px; letter-spacing: .8px; text-transform: uppercase; }
.coverage-note span { font-size: 11px; line-height: 1.55; }

.conversation-panel {
    height: 820px; height: clamp(680px, calc(100svh - 32px), 900px); min-height: 0; position: sticky; top: 16px;
    display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; overflow: hidden;
}
.conversation-header { min-height: 78px; padding: 12px 20px; display: flex; align-items: center; gap: 12px; color: #fff; background: var(--navy-2); border-bottom: 1px solid rgba(43,240,197,.2); }
.joker-avatar { width: 50px; height: 50px; overflow: hidden; border-radius: 50%; border: 1px solid var(--mint); box-shadow: 0 0 18px rgba(43,240,197,.2); }
.joker-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; }
.conversation-header > div:nth-child(2) { display: flex; flex-direction: column; }
.conversation-header strong { font-family: var(--serif); font-size: 20px; }
.conversation-header span { color: #9cb3b8; font-size: 10px; }
.conversation-header i { width: 7px; height: 7px; margin-right: 4px; display: inline-block; background: var(--mint); border-radius: 50%; box-shadow: 0 0 8px var(--mint); }
.conversation-header p { margin-left: auto; color: #779098; font-size: 11px; font-style: italic; }
.conversation-reset { min-height: 34px; padding: 0 11px; color: #b8d0d3; background: transparent; border: 1px solid rgba(43,240,197,.25); font-size: 10px; font-weight: 700; }
.conversation-reset:hover { color: var(--mint); border-color: rgba(43,240,197,.65); }
.conversation-reset:disabled { cursor: wait; opacity: .5; }
.messages {
    min-height: 0; padding: 26px; position: relative; overflow-x: hidden; overflow-y: auto;
    overscroll-behavior: contain; scrollbar-gutter: stable;
    background: linear-gradient(180deg, #f8fbfa 0%, #f2f6f4 100%);
}
.message { margin-bottom: 20px; display: grid; grid-template-columns: 82px minmax(0, 1fr); align-items: start; gap: 10px; }
.message-label { padding-top: 12px; color: #74868b; font-size: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; }
.message-body { max-width: 780px; padding: 20px 22px; background: #fff; border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(6,23,37,.05); }
.message-body h2 { margin: 0 0 9px; font: 600 26px/1.15 var(--serif); }
.message-body p { margin: 0; color: #4e6066; font-size: 13px; line-height: 1.65; }
.assistant-message .message-body { border-left: 3px solid var(--green); }
.user-message { grid-template-columns: minmax(0, 1fr) 54px; }
.user-message .message-label { grid-column: 2; grid-row: 1; }
.user-message .message-body { grid-column: 1; grid-row: 1; justify-self: end; color: #fff; background: var(--navy-2); border-color: var(--navy-2); border-left: 0; }
.user-message .message-body p { color: #e1ebec; }
.error-message .message-body { border-left-color: var(--red); }
.urgency-row { margin: -8px 0 14px; display: flex; align-items: center; gap: 10px; }
.urgency-badge { padding: 5px 8px; color: #0d6e5f; background: #dff7f1; font-size: 9px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; }
.urgency-row small { color: #708186; font-size: 10px; }
.severity-3 .urgency-badge { color: #7a5400; background: #fff0c8; }
.severity-4 .message-body, .severity-5 .message-body { border-left-color: var(--red); }
.severity-4 .urgency-badge, .severity-5 .urgency-badge { color: #991f2b; background: #ffe0e2; }
.answer-summary { font-size: 14px !important; }
.answer-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid #e3ebe8; }
.answer-section h3 { margin: 0 0 10px; color: #294047; font-size: 11px; letter-spacing: .8px; text-transform: uppercase; }
.answer-section ul { margin: 0; padding-left: 18px; }
.answer-section li { margin: 7px 0; color: #4c5e63; font-size: 12px; line-height: 1.55; }
.brand-positive { padding: 15px 17px; background: #e7f7f2; border: 0; border-left: 2px solid var(--green); }
.brand-positive h3 { color: #087763; }
.safety-actions { padding: 15px 17px; background: #fff0f1; border: 1px solid #ffd1d5; }
.safety-actions h3, .safety-actions li { color: #8a2730; }
.finding-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.finding-card { padding: 13px; background: #f3f7f5; border: 1px solid #e0e8e5; }
.finding-card strong { font-size: 12px; }
.finding-card p { margin-top: 6px; font-size: 11px; line-height: 1.5; }
.next-step { margin-top: 22px; padding: 16px 18px; color: #fff; background: var(--navy-2); }
.next-step span, .next-step strong { display: block; }
.next-step span { margin-bottom: 5px; color: var(--mint); font-size: 9px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.next-step strong { font-size: 13px; line-height: 1.5; }
.follow-up-buttons { display: flex; flex-wrap: wrap; gap: 7px; }
.follow-up-buttons button, .quick-prompts button { padding: 8px 11px; color: #315159; background: #fff; border: 1px solid #bcd4ce; font-size: 11px; text-align: left; }
.follow-up-buttons button:hover, .quick-prompts button:hover { color: #066a59; border-color: var(--green); }
.source-section { margin-top: 20px; color: #586a70; font-size: 11px; }
.source-section summary { cursor: pointer; color: #1b7365; font-weight: 700; }
.source-section ul { margin: 10px 0 0; padding-left: 18px; }
.source-section li { margin: 8px 0; }
.source-section a { color: #096b5b; font-weight: 600; }
.source-section small { margin-top: 3px; display: block; color: #829095; }
.limitations li { color: #7c898c; font-size: 10px; }
.privacy-notice { margin: -10px 0 20px 92px; color: #65797e; font-size: 10px; }
.quick-prompts { padding: 12px 24px 4px; display: flex; flex-wrap: wrap; gap: 7px; background: #fff; }
.chat-composer {
    margin: 0; padding: 14px 24px max(22px, env(safe-area-inset-bottom)); position: sticky; z-index: 5; bottom: 0;
    background: #fff; border-top: 1px solid #dce6e3; box-shadow: 0 -10px 24px rgba(6,23,37,.06);
}
.chat-composer textarea { width: 100%; min-height: 88px; padding: 14px; resize: vertical; color: var(--ink); background: #f8faf9; border: 1px solid #cbd9d5; outline: none; line-height: 1.5; }
.chat-composer textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(18,185,148,.1); }
.composer-footer { margin-top: 9px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.composer-footer > span { color: #829095; font-size: 10px; }
.composer-footer button { min-width: 132px; min-height: 43px; padding: 0 18px; color: #041915; background: var(--mint); border: 0; font-weight: 800; }
.composer-footer button:hover { background: #63f5d6; }
.composer-footer button:disabled { cursor: wait; opacity: .55; }

.chat-footer { min-height: 86px; padding: 24px max(24px, calc((100vw - 1320px) / 2)); display: flex; align-items: center; justify-content: space-between; gap: 20px; color: #8ca3a8; background: var(--navy); font-size: 11px; }
.chat-footer p { margin: 0; }
.chat-footer strong { color: var(--mint); }
.chat-footer nav { display: flex; gap: 18px; }
.visually-hidden { width: 1px !important; height: 1px !important; padding: 0 !important; position: absolute !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }

@media (max-width: 900px) {
    .joker-intro { grid-template-columns: 1fr; }
    .joker-portrait { min-height: 350px; border-right: 0; border-bottom: 1px solid rgba(43,240,197,.18); }
    .joker-portrait::after { background: linear-gradient(0deg, var(--navy) 0%, transparent 40%); }
    .joker-copy { padding: 38px 28px 70px; }
    .chat-workspace { grid-template-columns: 1fr; margin-top: -28px; }
    .vehicle-panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
    .panel-heading, .vehicle-panel > p, .mode-switch, .coverage-note { grid-column: 1 / -1; }
    .conversation-panel { height: 720px; height: max(620px, calc(100svh - 20px)); position: relative; top: auto; }
}

@media (max-width: 620px) {
    .chat-header { min-height: 64px; padding: 0 16px; }
    .chat-header nav a:first-child { display: none; }
    .joker-portrait { min-height: 300px; }
    .joker-copy h1 { font-size: 58px; }
    .chat-workspace { padding: 0 10px; margin-bottom: 35px; }
    .vehicle-panel { display: block; padding: 22px; }
    .conversation-header { padding: 10px 13px; }
    .conversation-header p { display: none; }
    .conversation-reset { margin-left: auto; }
    .conversation-panel { height: 640px; height: calc(100svh - 8px); min-height: 480px; }
    .messages { padding: 15px 11px; }
    .message, .user-message { display: block; }
    .message-label, .user-message .message-label { margin: 0 0 5px; padding: 0; }
    .message-body, .user-message .message-body { max-width: 100%; padding: 17px; }
    .finding-grid { grid-template-columns: 1fr; }
    .quick-prompts { padding: 10px 12px 2px; overflow-x: auto; flex-wrap: nowrap; }
    .quick-prompts button { min-width: 220px; }
    .chat-composer { padding: 12px; }
    .composer-footer { align-items: stretch; flex-direction: column; }
    .composer-footer button { width: 100%; }
    .privacy-notice { margin-left: 0; padding: 0 12px; }
    .chat-footer { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
