/* Ask AI in the builder (TRK-1008): the top bar's Ask AI button, the chat's "about" row, and the code diff */

.pe-ask-ai { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px 0 10px; margin-right: 4px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); font-size: 13px; font-weight: 600; white-space: nowrap; transition: background-color 150ms ease, border-color 150ms ease; }
.pe-ask-ai svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; color: var(--accent); }
.pe-ask-ai[aria-pressed="true"] { background: var(--sunken); border-color: var(--accent); }
.pe-ask-ai:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pe-ask-ai:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .pe-ask-ai:hover { background: var(--sunken); } }
.pe-ask-ai kbd { font: inherit; font-size: 11px; font-weight: 500; color: var(--muted); }
@media (max-width: 900px) { .pe-ask-ai kbd { display: none; } }
@media (max-width: 640px) { .pe-ask-ai { padding: 0 9px; } .pe-ask-ai .pe-ask-ai-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } }

/* The chat's about row: the chip, Point, then the quick changes on their own line */
.ask-about { flex-wrap: wrap; gap: 6px; align-items: center; }
.ask-about .ask-chip { min-width: 0; max-width: calc(100% - 92px); }
.ask-about .ask-chip strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ask-icon { display: inline-grid; flex-shrink: 0; place-items: center; }
.ask-icon svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ask-chip .ask-icon { color: var(--accent); }
button.ask-point { padding-right: 8px; color: var(--text); cursor: pointer; }
button.ask-point[aria-pressed="true"] { border-color: #7c3aed; color: #7c3aed; background: color-mix(in srgb, #7c3aed 10%, var(--surface)); }
button.ask-point:focus-visible, .ask-quick-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (hover: hover) and (pointer: fine) { button.ask-point:hover, .ask-quick-btn:hover:not(:disabled) { border-color: var(--muted); } }
.ask-quick { display: flex; flex-wrap: wrap; gap: 6px; flex-basis: 100%; }
.ask-quick-btn { display: inline-flex; align-items: center; gap: 5px; min-height: 28px; padding: 3px 10px 3px 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font-size: 12px; }
.ask-quick-btn:disabled { color: var(--muted); opacity: 0.6; }
.ask-quick-btn .ask-icon { color: var(--muted); }
@media (pointer: coarse) { .ask-quick-btn, button.ask-point { min-height: 36px; } }

/* A custom section's change: its code diff above the previews before and after */
.ask-diff { display: grid; gap: 12px; margin: 12px 0; }
.ask-diff-part { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius, 10px); overflow: hidden; }
.ask-diff-part h3 { display: flex; justify-content: space-between; gap: 8px; margin: 0; padding: 8px 12px; font-size: 13px; background: var(--sunken); border-bottom: 1px solid var(--border); }
.ask-diff-count { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ask-add { color: var(--pass); }
.ask-del { color: var(--danger); }
.ask-diff-lines { margin: 0; max-height: 320px; overflow: auto; overscroll-behavior: contain; font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; tab-size: 2; background: var(--surface); }
.ask-diff-lines:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ask-line { display: block; padding: 0 12px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.ask-mark { display: inline-block; width: 24px; text-align: center; color: var(--muted); user-select: none; }
.ask-line.ask-add { color: inherit; background: color-mix(in srgb, var(--pass) 13%, transparent); }
.ask-line.ask-del { color: inherit; background: color-mix(in srgb, var(--danger) 12%, transparent); }
.ask-line.ask-add .ask-mark { color: var(--pass); }
.ask-line.ask-del .ask-mark { color: var(--danger); }
.ask-line ins, .ask-line del { text-decoration: none; }
.ask-line.ask-fold { color: var(--muted); background: var(--sunken); font-style: italic; }
.ask-diff-none { margin: 12px 0; }

/* A wide window makes room in the builder too: the editor narrows and the chat sits beside it, full height */
@media (min-width: 1100px) {
  :root.claude-open .pe { right: calc(var(--claude-w, 420px) + 24px); }
  :root.claude-open:has(.pe) #agent-chat { top: 12px; }
}
