:root {
  color-scheme: light;
  --ink: #182338;
  --muted: #6d7890;
  --line: #e2e7f0;
  --surface: #ffffff;
  --canvas: #f5f7fb;
  --primary: #3857d6;
  --primary-dark: #2c46bb;
  --soft-blue: #eef1ff;
  --success: #2c9c71;
  --shadow: 0 20px 60px rgba(40, 55, 95, 0.1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; color: var(--ink); background: radial-gradient(circle at 0 0, #eaf0ff 0, transparent 38%), var(--canvas); }
button, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { display: grid; grid-template-columns: minmax(0, 760px) 300px; gap: 24px; max-width: 1120px; min-height: 100vh; margin: 0 auto; padding: 44px 24px; align-items: center; }
.chat-card, .debug-card { background: var(--surface); border: 1px solid rgba(226, 231, 240, .9); border-radius: 24px; box-shadow: var(--shadow); }
.chat-card { min-height: 640px; display: flex; flex-direction: column; overflow: hidden; }
.app-header { display: flex; justify-content: space-between; align-items: center; padding: 25px 30px 22px; border-bottom: 1px solid var(--line); }
.brand-lockup, .connection-state, .session-banner, .consent-panel, .debug-heading { display: flex; align-items: center; }
.brand-lockup { gap: 12px; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; color: white; background: var(--primary); font-weight: 800; font-size: 21px; box-shadow: 0 8px 16px rgba(56, 87, 214, .2); }
.eyebrow { margin: 0 0 4px; color: var(--primary); font-size: 10px; letter-spacing: .14em; font-weight: 800; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 18px; letter-spacing: -.02em; }
h2 { margin: 0; font-size: 17px; }
.connection-state { gap: 7px; color: var(--muted); font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px #e5f6ef; }
.session-banner { justify-content: space-between; gap: 16px; padding: 17px 30px; background: #fafbfe; border-bottom: 1px solid var(--line); }
.session-banner strong, .consent-panel strong { display: block; margin-bottom: 3px; font-size: 13px; }
.session-banner span, .consent-panel span { color: var(--muted); font-size: 12px; }
.button { border: 0; border-radius: 9px; padding: 9px 13px; font-size: 12px; font-weight: 700; transition: .15s ease; }
.button:hover { transform: translateY(-1px); }
.button-quiet { color: var(--primary); background: var(--soft-blue); }
.button-primary { color: white; background: var(--primary); }
.button-primary:hover { background: var(--primary-dark); }
.button-secondary { color: var(--ink); background: white; border: 1px solid var(--line); }
.message-list { flex: 1; min-height: 300px; max-height: 390px; overflow-y: auto; padding: 20px 30px 12px; }
.message { display: flex; gap: 9px; margin-bottom: 14px; animation: rise .2s ease-out; }
.message.user { justify-content: flex-end; }
.message-bubble { max-width: 72%; padding: 10px 13px; border-radius: 14px 14px 14px 5px; color: #33405a; background: #f0f3f8; font-size: 13px; line-height: 1.42; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.user .message-bubble { border-radius: 16px 16px 5px 16px; color: white; background: var(--primary); }
.message.user .message-bubble { min-width: 58px; text-align: left; }
.message-meta { margin-top: 4px; color: var(--muted); font-size: 9px; }
.message.user .message-meta { text-align: right; }
.avatar { flex: 0 0 26px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; color: var(--primary); background: var(--soft-blue); font-size: 11px; font-weight: 800; }
.typing { display: inline-flex; gap: 4px; align-items: center; }
.typing i { width: 5px; height: 5px; border-radius: 50%; background: #8995ae; animation: blink 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }.typing i:nth-child(3) { animation-delay: .3s; }
.composer { display: flex; align-items: flex-end; gap: 10px; margin: 0 30px; padding: 13px 0; border-top: 1px solid var(--line); }
.composer textarea { flex: 1; min-height: 42px; max-height: 120px; resize: none; padding: 12px 13px; border: 1px solid var(--line); border-radius: 12px; outline: none; color: var(--ink); background: #fbfcfe; font-size: 14px; line-height: 1.25; }
.composer textarea:focus { border-color: #98a8f0; box-shadow: 0 0 0 3px #eef1ff; }
.send-button { width: 42px; height: 42px; border: 0; border-radius: 12px; color: white; background: var(--primary); font-size: 22px; font-weight: 500; }
.send-button:disabled, .composer textarea:disabled { cursor: not-allowed; opacity: .55; }
.disclaimer { margin: 0; padding: 0 30px 20px; color: var(--muted); font-size: 11px; text-align: center; }
.consent-panel { justify-content: space-between; gap: 16px; margin: 0 30px 7px; padding: 13px 15px; border: 1px solid #dce3ff; border-radius: 13px; background: #f7f8ff; }
.consent-actions { display: flex; gap: 7px; flex-shrink: 0; }
.error-banner { margin: 0 30px 10px; padding: 10px 12px; border-radius: 9px; color: #9a3f44; background: #fff0f0; font-size: 12px; }
.debug-card { padding: 24px; }
.debug-heading { justify-content: space-between; margin-bottom: 26px; }
.mock-badge { padding: 5px 7px; border-radius: 6px; color: #6172c8; background: var(--soft-blue); font-size: 9px; font-weight: 800; letter-spacing: .1em; }
.phase-rail { position: relative; display: grid; gap: 17px; margin-bottom: 28px; }
.phase-rail::before { content: ""; position: absolute; top: 13px; bottom: 13px; left: 7px; width: 1px; background: var(--line); }
.phase { position: relative; display: flex; align-items: center; gap: 11px; color: #9ba5b8; font-size: 12px; }
.phase-marker { z-index: 1; width: 15px; height: 15px; border: 3px solid white; border-radius: 50%; background: #cfd5e1; box-shadow: 0 0 0 1px #cfd5e1; }
.phase.active { color: var(--primary); font-weight: 800; }.phase.active .phase-marker { background: var(--primary); box-shadow: 0 0 0 1px var(--primary); }.phase.done { color: var(--success); }.phase.done .phase-marker { background: var(--success); box-shadow: 0 0 0 1px var(--success); }
.state-list { margin: 0; padding-top: 20px; border-top: 1px solid var(--line); }.state-list div { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 14px; }.state-list dt { color: var(--muted); font-size: 11px; }.state-list dd { max-width: 155px; margin: 0; overflow: hidden; color: var(--ink); font-size: 11px; font-weight: 700; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.escalation-note { display: grid; gap: 3px; margin-top: 21px; padding: 12px; border-radius: 10px; color: #9a5a1f; background: #fff6e8; font-size: 11px; }.escalation-note span { color: #ae7840; }.debug-note { margin: 23px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } } @keyframes blink { 0%, 80%, 100% { opacity: .35; } 40% { opacity: 1; } }
@media (max-width: 1000px) { .app-shell { grid-template-columns: 1fr; align-items: start; max-width: 760px; padding: 22px 16px; }.debug-card { order: -1; margin-top: 0; margin-bottom: 16px; padding: 18px; }.chat-card { min-height: 0; }.message-list { flex: none; min-height: 0; max-height: 360px; } }
@media (max-width: 540px) { .app-shell { grid-template-columns: 1fr; padding: 0; }.debug-card { order: 2; margin-top: 16px; }.chat-card, .debug-card { border-radius: 0; border-right: 0; border-left: 0; }.app-header, .session-banner { padding-left: 20px; padding-right: 20px; }.message-list { padding: 20px; }.composer { margin: 0 20px; }.disclaimer { padding-left: 20px; padding-right: 20px; }.consent-panel { margin-left: 20px; margin-right: 20px; align-items: flex-start; flex-direction: column; }.connection-state { display: none; } }
