/* AI page loaders: wavy "Thinking..." text + step-by-step progress list (see ai-loaders.js). */
.ai-loader { align-self: flex-start; display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 380px; padding: 2px; }

/* ---- wavy cycling text ---- */
.ail-text { display: flex; align-items: baseline; gap: 10px; font-weight: 700; font-size: 1.05rem; color: var(--bright-text); }
.ail-text-word { display: flex; white-space: pre; min-width: max-content; }
.ail-wave { display: inline-block; animation: ailWave 1.6s ease-in-out infinite both; }
.ail-text-secs { font-weight: 500; font-size: 0.8rem; font-variant-numeric: tabular-nums; color: color-mix(in srgb, var(--bright-text) 45%, transparent); }
.ail-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@keyframes ailWave { 50% { opacity: 0.3; } }

/* ---- step list ---- */
.ail-root { width: 100%; }
.ail-card { width: 100%; }
.ail-head { display: flex; width: 100%; align-items: center; gap: 8px; padding: 4px 0; background: none; border: none; border-radius: 6px; font: inherit; font-size: 0.85rem; font-weight: 600; text-align: left; cursor: pointer; color: color-mix(in srgb, var(--bright-text) 78%, transparent); }
.ail-head:focus-visible { outline: 2px solid color-mix(in srgb, var(--bright-text) 35%, transparent); outline-offset: 2px; }
.ail-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ail-elapsed, .ail-count { flex-shrink: 0; font-weight: 500; font-variant-numeric: tabular-nums; color: color-mix(in srgb, var(--bright-text) 45%, transparent); }
.ail-chev { width: 16px; height: 16px; margin-left: auto; flex-shrink: 0; color: color-mix(in srgb, var(--bright-text) 45%, transparent); transition: transform 0.2s cubic-bezier(0.23, 1, 0.32, 1), color 0.15s; }
.ail-head:hover .ail-chev { color: color-mix(in srgb, var(--bright-text) 80%, transparent); }
.ail-chev.open { transform: rotate(180deg); }

.ail-steps { list-style: none; margin: 0; padding: 0; overflow: hidden; }
.ail-step { position: relative; display: flex; gap: 12px; padding-top: 12px; }
.ail-rail { position: absolute; top: 32px; bottom: -8px; left: 7.5px; width: 1px; overflow: hidden; background: color-mix(in srgb, var(--bright-text) 12%, transparent); }
.ail-rail-fill { display: block; width: 100%; height: 100%; transform-origin: top; transform: scaleY(0); background: color-mix(in srgb, var(--bright-text) 45%, transparent); transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1); }
.ail-rail-fill.on { transform: scaleY(1); }
.ail-marker { position: relative; width: 16px; height: 16px; flex-shrink: 0; display: grid; place-items: center; color: color-mix(in srgb, var(--bright-text) 85%, transparent); }
.ail-dot { width: 6px; height: 6px; border-radius: 50%; background: color-mix(in srgb, var(--bright-text) 25%, transparent); }
.ail-icon { width: 14px; height: 14px; }
.ail-spinner { animation: ailSpin 0.8s linear infinite; }
.ail-spin-track { stroke: color-mix(in srgb, var(--bright-text) 15%, transparent); }
.ail-spin-head { stroke: color-mix(in srgb, var(--bright-text) 85%, transparent); }
@keyframes ailSpin { to { transform: rotate(360deg); } }

.ail-body { flex: 1; min-width: 0; margin-top: -2px; }
.ail-row { display: flex; align-items: baseline; gap: 8px; }
.ail-label { min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.85rem; transition: color 0.2s; }
.ail-pending .ail-label { color: color-mix(in srgb, var(--bright-text) 38%, transparent); }
.ail-running .ail-label { color: var(--bright-text); }
.ail-done .ail-label { color: color-mix(in srgb, var(--bright-text) 58%, transparent); }
.ail-error .ail-label, .ail-error .ail-marker { color: #ff6b6b; }
html[data-theme="light"] .ail-error .ail-label, html[data-theme="light"] .ail-error .ail-marker { color: #c62828; }
.ail-time { margin-left: auto; flex-shrink: 0; font-size: 0.72rem; font-variant-numeric: tabular-nums; color: color-mix(in srgb, var(--bright-text) 40%, transparent); }

.ail-lines { position: relative; margin-top: 4px; overflow: hidden; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.72rem; }
.ail-lines-track { transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1); }
.ail-line { display: flex; align-items: center; gap: 8px; color: color-mix(in srgb, var(--bright-text) 55%, transparent); }
.ail-ln { width: 16px; flex-shrink: 0; text-align: right; user-select: none; font-variant-numeric: tabular-nums; color: color-mix(in srgb, var(--bright-text) 28%, transparent); }
.ail-lt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
    .ail-wave, .ail-spinner { animation: none; }
    .ail-rail-fill, .ail-lines-track, .ail-chev { transition: none; }
}
