.ca-tabs { display:flex; gap:10px; margin:0 0 14px; border-bottom:1px solid var(--line,#263942); padding-bottom:10px; }
.ca-tabs [aria-selected=true] { color:var(--accent,#78e8ba); border-color:var(--accent,#78e8ba); }
.ca-tabs small { margin-left:6px; }
.ca-panel { display:grid; grid-template-columns:190px minmax(0,1fr); border:1px solid var(--line,#263942); border-radius:12px; overflow:hidden; background:var(--panel,#101c23); min-height:65dvh; }
#app .ca-history { position:static; width:auto; padding:14px; background:#0c171d; border-right:1px solid var(--line,#263942); display:block; }
#caHistory { display:flex; flex-direction:column; gap:6px; max-height:62dvh; overflow-y:auto; margin-top:12px; }
#caHistory button { text-align:left; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; width:100%; font-size:12px; }
#caHistory [aria-current=true] { border-color:var(--accent,#78e8ba); }
.ca-conversation { display:flex; flex-direction:column; min-width:0; padding:14px 18px; }
.ca-chat-actions, .ca-compose-actions { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.ca-chat-actions { color:var(--muted,#91a6b1); font-size:13px; }
.ca-chat-actions button { font-size:11px; }
.ca-messages { flex:1; min-height:140px; max-height:56dvh; overflow-y:auto; overscroll-behavior:contain; padding:10px 0; }
.ca-message { box-sizing:border-box; min-width:0; max-width:min(88%,760px); margin:0 0 20px; overflow-wrap:anywhere; border:1px solid; border-radius:16px; padding:14px 16px; }
.ca-message p { white-space:pre-wrap; }
.ca-author { display:block; color:var(--muted,#91a6b1); font-size:12px; margin-bottom:6px; }
.ca-user { margin-left:auto; background:#173A63; color:#FFFFFF; border-color:#28527E; }
.ca-user .ca-author { color:#FFFFFF; }
.ca-user p { margin:0; color:inherit; }
.ca-assistant { margin-right:auto; background:#1B252D; color:#E5E7EB; border-color:#34414B; }
.ca-assistant .ca-author, .ca-assistant details, .ca-assistant small { color:#BCC6CF; }
.ca-assistant>button { background:#26333D; color:#E5E7EB; border-color:#465460; }
.ca-assistant summary { cursor:pointer; }
.ca-assistant details p { color:inherit; }
.ca-assistant>button { font-size:11px; margin-top:8px; }
.ca-markdown { line-height:1.65; font-size:14px; }
.ca-markdown p, .ca-markdown li { color:inherit; }
.ca-markdown pre { max-width:100%; background:#111827; color:#F9FAFB; padding:12px; border-radius:7px; overflow:auto; white-space:pre; overflow-wrap:normal; }
.ca-markdown code { font-family:monospace; background:#303D48; color:#F3F4F6; padding:1px 3px; }
.ca-markdown pre code { background:transparent; color:inherit; padding:0; }
.ca-markdown a { color:#93C5FD; text-decoration:underline; }
.ca-markdown h3, .ca-markdown h4, .ca-markdown h5, .ca-markdown strong, .ca-markdown em { color:inherit; }
.ca-markdown ul, .ca-markdown ol { padding-left:24px; }
.ca-table { max-width:100%; overflow-x:auto; }
.ca-markdown table { border-collapse:collapse; width:100%; }
.ca-markdown td, .ca-markdown th { padding:7px; border:1px solid #465460; text-align:left; color:#E5E7EB; }
.ca-message details, .ca-message small { color:var(--muted,#91a6b1); font-size:11px; }
.ca-message small { display:block; overflow-wrap:anywhere; margin-top:3px; }
.ca-assistant details, .ca-assistant small { color:#BCC6CF; }
.ca-processing { display:flex; align-items:center; gap:10px; font-size:13px; }
.ca-processing-icon { display:grid; place-items:center; flex:none; width:26px; height:26px; border-radius:50%; background:#173A63; color:#FFFFFF; font-weight:700; }
.ca-processing-copy { min-width:0; }
.ca-dots { display:inline-flex; gap:3px; margin-left:7px; vertical-align:middle; }
.ca-dots span { width:4px; height:4px; background:#93C5FD; border-radius:50%; animation:ca-pulse 1.2s ease-in-out infinite; }
.ca-dots span:nth-child(2) { animation-delay:.15s; }
.ca-dots span:nth-child(3) { animation-delay:.3s; }
@keyframes ca-pulse { 0%,80%,100% { opacity:.3; transform:translateY(0); } 40% { opacity:1; transform:translateY(-3px); } }
@media(prefers-reduced-motion:reduce) { .ca-dots span { animation:none; opacity:1; } }
.ca-empty { margin:auto; padding:36px 10px 16px; text-align:center; }
.ca-empty h2 { font-size:22px; }
#caSuggestions { display:flex; justify-content:center; flex-wrap:wrap; gap:8px; }
#caSuggestions button { font-size:12px; }
.ca-composer { margin-top:auto; border:1px solid #38505e; border-radius:12px; padding:10px; background:#14232c; }
.ca-composer textarea { resize:vertical; width:100%; min-height:54px; max-height:180px; border:0; background:transparent; padding:4px; font:inherit; color:inherit; }
.ca-compose-actions label { display:flex; align-items:center; gap:5px; font-size:11px; color:var(--muted,#91a6b1); }
.ca-compose-actions input { width:auto; }
#caForm .ca-compose-actions { flex-wrap:wrap; }
.ca-send-actions { display:flex; align-items:center; gap:8px; margin-left:auto; }
.ca-voice-button { display:grid; place-items:center; flex:none; width:42px; height:42px; padding:0; border-radius:50%; background:#21303a; border:1px solid #38505e; color:#d7e2ea; }
.ca-voice-button svg { width:19px; height:19px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.ca-voice-button:hover { background:#2b3d49; }
.ca-voice-button:focus-visible { outline:2px solid #a8c987; outline-offset:3px; }
.ca-voice-button:disabled { opacity:.5; cursor:wait; }
.ca-voice-note { margin-top:8px; font-size:11px; line-height:1.6; color:var(--muted,#91a6b1); overflow-wrap:anywhere; }
.ca-voice-note code { color:#d7e2ea; user-select:all; }
.ca-voice-dialog { position:fixed; inset:0; width:min(620px,calc(100vw - 24px)); height:min(850px,calc(100dvh - 24px)); max-width:none; max-height:none; margin:auto; padding:0; border:1px solid #354650; border-radius:20px; overflow:hidden; background:#0b1217; }
.ca-voice-dialog[open] { display:flex; flex-direction:column; }
.ca-voice-dialog::backdrop { background:#02070bc9; backdrop-filter:blur(4px); }
.ca-voice-dialog-header { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px 18px; border-bottom:1px solid #27343d; }
.ca-voice-dialog-header small { display:block; margin-top:4px; font-size:11px; color:#92a2ad; overflow-wrap:anywhere; }
.ca-voice-dialog-header button { flex:none; width:38px; height:38px; padding:0; font-size:24px; border-radius:50%; }
.ca-voice-dialog iframe { flex:1; width:100%; min-height:0; border:0; background:#0b1217; }
@media(max-width:600px) { .ca-voice-dialog { width:calc(100vw - 12px); height:calc(100dvh - 12px); border-radius:14px; } }
.ca-status, .ca-usage, .ca-note { font-size:11px; color:var(--muted,#91a6b1); margin:6px 0; }
.ca-sr-only { position:absolute; height:1px; width:1px; overflow:hidden; clip:rect(0,0,0,0); }
@media(max-width:850px) {
 .ca-panel { grid-template-columns:1fr; min-height:70dvh; }
 #app .ca-history { border-right:0; border-bottom:1px solid var(--line,#263942); padding:10px; }
 #caHistory { flex-direction:row; max-width:100%; max-height:64px; margin-top:8px; }
 #caHistory button { max-width:150px; flex-shrink:0; }
 .ca-conversation { padding:12px; }
 .ca-messages { max-height:52dvh; }
 .ca-message { max-width:96%; padding:12px; }
 .ca-empty h2 { font-size:19px; }
}

/* Chat management stays scoped to the CONTRA Agent panel. */
#caSearch { width:100%; margin:10px 0 8px; min-width:0; }
#caArchived, #caMore { width:100%; font-size:12px; }
#caHistory .ca-history-item { position:relative; min-width:0; border:1px solid var(--line,#263942); border-radius:9px; padding:4px; }
#caHistory .ca-history-open { padding-right:38px; border-color:transparent; }
#caHistory [aria-current=true] { border-color:var(--accent,#78e8ba); }
.ca-history-time { display:block; color:var(--muted,#91a6b1); font-size:10px; padding:0 6px 4px; overflow-wrap:anywhere; }
#caHistory summary { position:absolute; right:4px; top:4px; width:32px; min-height:36px; display:grid; place-items:center; cursor:pointer; border-radius:7px; font-size:20px; list-style:none; }
#caHistory summary::-webkit-details-marker { display:none; }
#caHistory summary:hover, #caHistory summary:focus-visible { background:#26333D; }
.ca-history-menu { display:grid; gap:5px; padding:6px 0; }
#caHistory .ca-history-menu button { white-space:normal; min-height:40px; }
.ca-selected-actions { display:flex; gap:6px; flex-wrap:wrap; }
.ca-chat-actions { flex-wrap:wrap; }
.ca-commands { max-height:220px; overflow-y:auto; border:1px solid #465460; border-radius:10px; padding:5px; margin-bottom:8px; background:#1B252D; }
.ca-commands[hidden] { display:none; }
.ca-commands button { display:block; width:100%; text-align:left; border:0; background:transparent; min-height:44px; }
.ca-commands button[aria-selected=true], .ca-commands button:hover { background:#173A63; }
.ca-commands strong, .ca-commands span { display:block; overflow-wrap:anywhere; color:#E5E7EB; }
.ca-commands span { font-size:11px; margin-top:3px; }
#caCommandNote:empty { display:none; }
@media(max-width:850px) {
 #caHistory { flex-direction:column; max-height:200px; overflow:auto; }
 #caHistory button { max-width:none; }
 .ca-commands { max-height:180px; }
}

.ca-kline{width:100%;min-width:0;box-sizing:border-box;margin:16px 0;padding:12px;border:1px solid #293c46;border-radius:10px;background:#101a20;overflow:hidden}.ca-kline p,.ca-kline small{overflow-wrap:anywhere}.ca-kline small,.ca-kline a{display:block;color:#9babb5;font-size:12px}.ca-kline button{margin:5px;padding:8px 12px}.ca-gmgn-frame{display:block;width:100%;height:560px;border:0;border-radius:8px;margin-top:10px;background:#101010}.ca-kline-expanded{position:fixed;inset:12px;z-index:10000;width:auto;overflow:auto;box-shadow:0 0 0 30px #0009}.ca-kline-expanded .ca-gmgn-frame{height:calc(100dvh - 230px);min-height:360px}@media(max-width:600px){.ca-kline{padding:6px}.ca-gmgn-frame{height:520px}.ca-kline-expanded{inset:4px}}
