/* ==========================================================================
   Taha Auto admin: live AI edits ("Apply live + Undo", js/live-run.js)
   .ai-working: what's being changed right now (an accent outline that pulses)
   .ai-flash: what a change did (a 2 px accent ring and a glow that fades over about 2.4 s; JS takes the class off after)
   .ai-chip--err: a change that couldn't land, with why · .ai-undo: the "N changes · Undo" toast · .ai__livesw: the panel's switch
   ========================================================================== */
.ai-working { outline: 2px solid rgba(var(--accent-rgb), .55); outline-offset: 2px; border-radius: 10px; animation: ai-working 1.1s ease-in-out infinite; }
@keyframes ai-working { 50% { outline-color: rgba(var(--accent-rgb), .15); } }
.ai-flash { border-radius: 10px; animation: ai-flash var(--ai-flash-ms, 2400ms) cubic-bezier(.23, 1, .32, 1) both; }
@keyframes ai-flash {
  0% { box-shadow: 0 0 0 2px var(--accent-ui), 0 0 0 0 rgba(var(--accent-rgb), .5); }
  25% { box-shadow: 0 0 0 2px var(--accent-ui), 0 0 18px 4px rgba(var(--accent-rgb), .35); }
  100% { box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0), 0 0 18px 4px rgba(var(--accent-rgb), 0); }
}
input.ai-flash, textarea.ai-flash, select.ai-flash { background-color: rgba(var(--accent-rgb), .08); }
.ai-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; line-height: 1.35; }
.ai-chip--err { background: rgba(224, 32, 32, .14); border: 1px solid var(--danger); color: var(--danger-text); }
.ed__top .ai-chip { flex-basis: 100%; order: 99; }

/* the toast: above the tab bar on a phone, bottom centre on a computer */
.ai-undo { position: fixed; z-index: 41; left: 16px; right: 16px; bottom: calc(var(--tabbar-h, 0px) + env(safe-area-inset-bottom) + 16px); margin: 0 auto; max-width: 460px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 10px 16px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line-2); box-shadow: 0 12px 32px rgba(0, 0, 0, .45); color: var(--text); font-size: 14px;
  opacity: 0; transform: translateY(12px); transition: opacity 180ms cubic-bezier(.23, 1, .32, 1), transform 180ms cubic-bezier(.23, 1, .32, 1); }
.ai-undo[hidden] { display: none; }
.ai-undo.is-on { opacity: 1; transform: none; }
.ai-undo__text { display: grid; gap: 2px; min-width: 0; }
.ai-undo__text b { font-weight: 600; overflow-wrap: anywhere; }
.ai-undo__text small { color: var(--text-3); font-size: 12.5px; }
.ai-undo__btn { flex: none; min-height: 44px; padding: 0 16px; border-radius: 10px; border: 0; background: var(--accent-soft); color: var(--accent-text); font: inherit; font-weight: 700; cursor: pointer; }
.ai-undo__btn:active { transform: scale(.97); }

/* the conversation: the run's Undo line, a change's own Undo, the panel's switch, a card that runs live changes */
.ai__live { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
.ai__undo1 { margin-left: 4px; padding: 2px 8px; min-height: 28px; border-radius: 8px; border: 1px solid var(--line-2); background: none; color: var(--accent-text); font: inherit; font-size: 12px; cursor: pointer; }
.ai__undo1:disabled { color: var(--text-3); cursor: default; }
.ai__livesw { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12.5px; color: var(--text-2); cursor: pointer; min-height: 32px; }
.ai__livesw input { width: 18px; height: 18px; accent-color: var(--accent-ui); margin: 0; }
.prop--live .prop__line { margin-top: 4px; }

@media (prefers-reduced-motion: reduce) {
  .ai-working { animation: none; }
  .ai-flash { animation: none; box-shadow: 0 0 0 2px var(--accent-ui); }   /* a static ring; the timer takes it off */
  .ai-undo { transition: none; }
}
/* "Keep working off the app" (js/ai-jobs.js) next to "Apply live" */
.ai__livesw + .ai__livesw { margin-left: 14px; }
