/* Read-only AI assistance, using the existing black-and-gold brand. */
.ai-insights-card { margin: 22px 0; padding: 22px; border-color: var(--control-line); }
.ai-insights-card .card-head { flex-wrap: wrap; gap: 16px; }
.ai-insights-card h2 { margin-top: 7px; }
.ai-connection { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 11px; margin: 12px 0; }
.ai-connection strong { color: var(--ink); }
.ai-status-dot { width: 7px; height: 7px; background: var(--gold); border-radius: 50%; flex-shrink: 0; }
.ai-setup { background: var(--surface-raised); border: 1px solid var(--line); padding: 15px; border-radius: 6px; margin: 12px 0; font-size: 12px; }
.ai-setup > strong { color: var(--gold-hover); }
.ai-setup p { color: var(--muted); line-height: 1.65; margin: 9px 0; }
.ai-setup details { margin: 12px 0; }.ai-setup summary { color: var(--ink); cursor: pointer; }.ai-setup code { color: var(--gold); font-size: 11px; overflow-wrap: anywhere; }
.ai-setup .btn { min-height: 36px; padding: 8px 12px; font-size: 11px; }
.ai-verified { display: flex; flex-wrap: wrap; gap: 18px; padding: 14px 0; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.ai-verified span { display: flex; gap: 8px; }.ai-verified strong { color: var(--ink); }
.ai-answer { border-left: 2px solid var(--gold); padding: 15px 18px; background: var(--surface-raised); }
.ai-answer.stale { border-color: var(--control-line); }.ai-answer-meta { color: var(--gold-hover); font-size: 10px; line-height: 1.65; }.ai-answer.stale .ai-answer-meta { color: var(--muted); }
.ai-answer p { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.85; font-size: 13px; margin: 12px 0 0; }
.ai-note,.ai-loading { color: var(--muted); font-size: 11px; line-height: 1.65; margin-top: 16px; }
.ai-launcher { position: fixed; right: 22px; bottom: 22px; z-index: 20; border: 1px solid var(--gold); background: var(--gold); color: var(--bg); box-shadow: 0 6px 24px #0007; border-radius: 6px; min-height: 46px; padding: 12px 18px; font: inherit; font-size: 12px; font-weight: 800; }
.ai-launcher:hover { background: var(--gold-hover); }
.ai-chat-panel { position: fixed; right: 22px; bottom: 22px; width: min(420px,calc(100vw - 44px)); height: min(720px,calc(100dvh - 44px)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--control-line); border-radius: 9px; z-index: 22; box-shadow: 0 12px 60px #000a; overflow: hidden; }
.ai-chat-head { display: flex; justify-content: space-between; gap: 14px; padding: 18px; background: var(--surface-raised); border-bottom: 1px solid var(--line); flex: 0 0 auto; }.ai-chat-head h2 { margin: 5px 0; font-size: 21px; }.ai-chat-head small { color: var(--muted); font-size: 10px; }.ai-chat-head .icon-btn { min-width: 36px; height: 36px; font-size: 23px; }
.ai-chat-context { padding: 0 16px 10px; border-bottom: 1px solid var(--line); flex: 0 0 auto; font-size: 10px; }.ai-chat-context > p { color: var(--muted); line-height: 1.65; margin: 8px 0 0; }.ai-chat-context .ai-setup { padding: 10px; margin-bottom: 0; font-size: 11px; }.ai-chat-context .ai-connection { margin: 10px 0 0; }
.ai-chat-messages { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px; overscroll-behavior: contain; }.ai-message { padding: 12px 14px; margin-bottom: 12px; background: var(--surface-raised); border: 1px solid var(--line); border-radius: 6px; }.ai-message.user { margin-left: 28px; background: var(--gold-surface); border-color: var(--gold); }.ai-message.assistant { margin-right: 12px; }.ai-message strong { color: var(--gold-hover); font-size: 10px; }.ai-message p { font-size: 12px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0 0; }.ai-message small { color: var(--muted); display: block; font-size: 9px; margin-top: 9px; }
.ai-welcome { display: grid; gap: 10px; font-size: 12px; }.ai-welcome p { color: var(--muted); line-height: 1.65; }.ai-welcome button { text-align: left; color: var(--gold-hover); background: var(--surface-raised); border: 1px solid var(--control-line); border-radius: 5px; min-height: 42px; padding: 10px 12px; font: inherit; font-size: 11px; }
.ai-chat-error { background: var(--surface-raised); padding: 12px; border: 1px solid #e9978d; border-radius: 5px; color: #e9978d; font-size: 12px; line-height: 1.6; }.ai-chat-error p { margin: 0 0 8px; }
.ai-chat-form { padding: 12px 16px; border-top: 1px solid var(--line); flex: 0 0 auto; }.ai-chat-form textarea { width: 100%; resize: vertical; max-height: 120px; min-height: 54px; padding: 10px 12px; background: var(--bg); color: var(--ink); border: 1px solid var(--control-line); border-radius: 5px; font: inherit; font-size: 12px; }.ai-chat-form > div { display: flex; justify-content: space-between; align-items: center; margin-top: 9px; }.ai-chat-form .btn { min-height: 36px; padding: 8px 15px; font-size: 11px; }
.ai-chat-foot { padding: 0 16px 12px; color: var(--muted); font-size: 10px; flex: 0 0 auto; }.ai-chat-foot .inline-link { font-size: 10px; }
.modal-open .ai-launcher,.modal-open .ai-chat-panel { visibility: hidden; }
@media (max-width:545px) { .ai-insights-card { padding: 16px; }.ai-verified { gap: 10px; }.ai-launcher { right: 14px; bottom: 14px; }.ai-chat-panel { right: 10px; bottom: 10px; width: calc(100vw - 20px); height: min(700px,calc(100dvh - 20px)); }.ai-chat-head { padding: 14px; }.ai-chat-context > p { font-size: 9px; }.ai-answer { padding: 12px; } }
@media print { .ai-launcher,.ai-chat-panel { display: none; }.ai-insights-card .btn,.ai-setup { display: none; }.ai-answer { break-inside: avoid; } }

.ai-chat-form .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
