/* AI Insurance Agent chat. Reuses app tokens; dark-mode via body.dark-mode. */

.ag-header { padding: 16px 20px 0; }
.ag-main { padding: 12px 20px 24px; }

.ag-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 1px 4px var(--shadow); }
.ag-chat-card { display: flex; flex-direction: column; height: calc(100vh - 150px); min-height: 420px; }

.ag-card-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.ag-card-icon { font-size: 18px; }
.ag-card-title { font-weight: 700; }
.ag-status { font-size: 12px; color: var(--text-secondary); margin-left: 8px; }
.ag-clear { margin-left: auto; }

.ag-btn {
    background: var(--bg-input); color: var(--text); border: 1px solid var(--border);
    border-radius: 8px; padding: 6px 12px; font-size: 13px; cursor: pointer;
}
.ag-btn:hover { border-color: var(--apple-blue); }

/* Messages */
.ag-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.ag-msg { max-width: 80%; padding: 11px 14px; border-radius: 14px; font-size: 14px; line-height: 1.5; word-break: break-word; }
.ag-msg-user { align-self: flex-end; background: var(--apple-blue); color: #fff; border-bottom-right-radius: 4px; }
.ag-msg-ai { align-self: flex-start; background: var(--bg-input); color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.ag-msg code { background: rgba(127,127,127,.18); padding: 1px 5px; border-radius: 5px; font-size: 13px; }
.ag-code { background: rgba(127,127,127,.14); padding: 10px; border-radius: 8px; overflow-x: auto; font-size: 12.5px; white-space: pre-wrap; }

/* Typing indicator — reuses the shared vmDotPulse keyframe (css/animations.css) */
.ag-typing { display: flex; gap: 5px; align-items: center; }
.ag-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-secondary); animation: vmDotPulse 1.2s infinite both; }
.ag-dot:nth-child(2) { animation-delay: .2s; }
.ag-dot:nth-child(3) { animation-delay: .4s; }

/* Citations */
.ag-citations { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
.ag-cite-head { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); margin-bottom: 4px; }
.ag-citations ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.ag-citations li { font-size: 12.5px; display: flex; gap: 6px; align-items: baseline; }
.ag-cite-n { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.ag-citations button { background: none; border: none; padding: 0; font: inherit; color: var(--text); text-align: left; cursor: default; }
.ag-cite-link { color: var(--apple-blue) !important; cursor: pointer !important; text-decoration: underline; }

/* Email draft card */
.ag-email-card { margin-top: 10px; background: var(--bg-card); border: 1px solid var(--apple-blue); border-radius: 12px; padding: 12px; }
.ag-email-head { font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.ag-email-note { font-weight: 400; font-size: 11px; color: var(--warning, #ff9f0a); margin-left: 6px; }
.ag-email-row { display: flex; gap: 8px; font-size: 13px; margin-bottom: 4px; }
.ag-email-row span:first-child { color: var(--text-secondary); min-width: 56px; }
.ag-email-body { font-size: 13px; line-height: 1.5; margin: 8px 0; padding: 10px; background: var(--bg-input); border-radius: 8px; white-space: normal; }
.ag-email-actions { display: flex; gap: 8px; }

/* Confirmation-gated action card (Phase 2 — writes never auto-run) */
.ag-action-card { margin-top: 10px; background: var(--bg-card); border: 1px solid var(--warning, #ff9f0a); border-radius: 12px; padding: 12px; }
.ag-action-card.is-done { border-color: var(--success, #32d74b); color: var(--text-secondary); font-size: 13px; }
.ag-action-check { color: var(--success, #32d74b); font-weight: 700; }
.ag-action-label { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.ag-action-note { font-size: 11px; color: var(--text-secondary); margin-bottom: 8px; }
.ag-action-actions { display: flex; gap: 8px; }
.ag-btn-primary { background: var(--apple-blue); color: #fff; border-color: var(--apple-blue); }

/* Input */
.ag-context { margin: 0 16px; background: var(--bg-input); color: var(--text); border: 1px solid var(--apple-blue); border-radius: 10px; padding: 10px; font-size: 13px; resize: vertical; }
.ag-input-row { display: flex; align-items: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.ag-context-toggle { white-space: nowrap; }
.ag-context-toggle[aria-pressed="true"] { background: var(--apple-blue); color: #fff; border-color: var(--apple-blue); }
.ag-input {
    flex: 1; resize: none; background: var(--bg-input); color: var(--text);
    border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 14px;
    font-family: inherit; line-height: 1.4; max-height: 140px;
}
.ag-input:focus { outline: none; border-color: var(--apple-blue); }
.ag-send-btn {
    flex-shrink: 0; width: 40px; height: 40px; border-radius: 10px; cursor: pointer;
    background: var(--apple-blue); color: #fff; border: none; display: flex; align-items: center; justify-content: center;
}
.ag-send-btn:disabled { opacity: .5; cursor: default; }
.ag-disclaimer { padding: 0 16px 12px; font-size: 11px; color: var(--text-secondary); }
