/* =============================================================================
 * ai-assistant.css — the LimeliChat operator-assistant panel + launcher.
 *
 * A right-docked, NON-MODAL working surface (not LLDrawer — it borrows only the
 * motion vocabulary). Read-only Phase 1: greeting + suggestion chips, user
 * bubbles, assistant markdown replies, a thinking state. Structured so a future
 * `.ll-ai-card` (proposed-action) message type slots in cleanly (Phase 2).
 *
 * All color/type/elevation is on the shared --ll-* OKLCH tokens (see ui.css).
 * Bans honored (DESIGN.md): no gradient text, no glassmorphism, no side-stripe
 * borders, no neon-on-dark. Motion respects prefers-reduced-motion.
 *
 * z-index ladder (see plan): launcher 1060 < panel 1070 < entity drawer 1080 <
 * toasts 1100. The panel deliberately sits UNDER toasts + the entity drawer.
 * ============================================================================= */

/* ---- Launcher (FAB) ------------------------------------------------------- */
/* A single floating pill button, bottom-right, above content but below the
   panel + toasts. Hidden until the role-gate reveals it (fail-safe hidden). */
.ll-ai-launcher {
  position: fixed; right: 24px; bottom: 24px; z-index: 1060;
  display: none;                 /* revealed by JS once role-gate passes */
  align-items: center; gap: 9px;
  height: 48px; padding: 0 18px 0 15px;
  font-family: var(--ll-font); font-size: var(--ll-fs-md); font-weight: 600;
  color: var(--ll-on-ink);
  background: var(--ll-ink);
  border: 1px solid var(--ll-ink-line); border-radius: var(--ll-r-pill);
  box-shadow: var(--ll-shadow-2);
  cursor: pointer; -webkit-appearance: none; appearance: none;
  transition: background-color .16s var(--ll-ease), border-color .16s var(--ll-ease),
              box-shadow .16s var(--ll-ease), transform .1s var(--ll-ease);
}
.ll-ai-launcher.ll-ai-show { display: inline-flex; }
/* The panel being open collapses the launcher to nothing (no double surface). */
.ll-ai-launcher.ll-ai-launcher-hidden { display: none; }
.ll-ai-launcher .ll-ai-launcher-mark {
  width: 22px; height: 22px; flex: none; display: inline-flex;
  align-items: center; justify-content: center;
}
.ll-ai-launcher .ll-ai-launcher-mark svg { width: 22px; height: 22px; display: block; }
/* Unread-insights count on the launcher (filled by insights-badge.js; hidden
   at zero). Sits on the pill's top-right corner; the ink ring separates it
   from whatever page content scrolls behind. */
.ll-ai-launcher .ll-ai-fab-badge {
  position: absolute; top: -7px; right: -4px;
  min-width: 20px; height: 20px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--ll-accent-ink); background: var(--ll-accent);
  border: 2px solid var(--ll-ink); border-radius: var(--ll-r-pill);
}
.ll-ai-launcher .ll-ai-fab-badge[hidden] { display: none; }
@media (hover: hover) and (pointer: fine) {
  .ll-ai-launcher:hover {
    background: var(--ll-ink-soft); border-color: var(--ll-accent-line);
    box-shadow: 0 14px 34px oklch(0.3 0.04 156 / 0.16), 0 4px 10px oklch(0.3 0.04 156 / 0.10);
  }
}
.ll-ai-launcher:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ll-focus), var(--ll-shadow-2); }
.ll-ai-launcher:active { transform: scale(0.96); }

/* ---- Scrim (mobile only) -------------------------------------------------- */
/* Desktop: the panel is a non-modal overlay, NO scrim (work stays visible +
   clickable behind it). Below 640px it goes full-width, so a light scrim reads
   the underlying content as inactive. */
.ll-ai-scrim {
  position: fixed; inset: 0; z-index: 1069;
  background: oklch(0.22 0.04 156 / 0);
  opacity: 0; pointer-events: none;
  transition: opacity .28s var(--ll-ease);
}

/* ---- Panel --------------------------------------------------------------- */
.ll-ai-panel {
  /* Offset below the impersonation / support-access banner when one is mounted
     (auth.js sets --ll-imp-banner-h); falls back to 0 with no banner. */
  position: fixed; top: var(--ll-imp-banner-h, 0); right: 0; bottom: 0; z-index: 1070;
  width: min(420px, 100vw); max-width: 100vw;
  display: flex; flex-direction: column;
  background: var(--ll-panel);
  border-left: 1px solid var(--ll-border);
  box-shadow: var(--ll-shadow-drawer);
  transform: translateX(100%);
  transition: transform .32s var(--ll-ease);
  will-change: transform;
  font-family: var(--ll-font); color: var(--ll-text);
}
.ll-ai-panel.ll-ai-open { transform: translateX(0); }

/* ---- Head: LimeliChat brand strip (deep-forest, mirrors the sidebar) ------ */
.ll-ai-head {
  display: flex; align-items: center; gap: 11px;
  padding: 15px 16px 15px 18px;
  background: var(--ll-ink);
  border-bottom: 1px solid var(--ll-ink-line);
  flex: none;
}
.ll-ai-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ll-ai-brandmark {
  width: 26px; height: 26px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.ll-ai-brandmark svg {
  width: 26px; height: 26px; display: block;
  filter: drop-shadow(0 0 8px oklch(0.78 0.17 138 / 0.20));
}
.ll-ai-wordmark {
  font-family: var(--ll-display); font-weight: 700; font-size: 1.06rem;
  letter-spacing: -0.02em; color: var(--ll-on-ink); line-height: 1;
}
.ll-ai-wordmark span { color: var(--ll-accent); }
.ll-ai-head-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.ll-ai-headbtn {
  background: transparent; border: none; cursor: pointer;
  width: 32px; height: 32px; border-radius: var(--ll-r-sm);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ll-on-ink-mut); font-size: 0.95rem; line-height: 0;
  transition: background-color .15s var(--ll-ease), color .15s var(--ll-ease);
}
@media (hover: hover) and (pointer: fine) {
  .ll-ai-headbtn:hover { background: oklch(0.4 0.04 156 / 0.5); color: var(--ll-on-ink); }
}
.ll-ai-headbtn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ll-focus); }

/* ---- Context chip (which page the assistant is looking at) ---------------- */
.ll-ai-context {
  display: none; align-items: center; gap: 7px;
  padding: 8px 18px; flex: none;
  font-size: var(--ll-fs-xs); color: var(--ll-text-mute);
  background: var(--ll-elevated); border-bottom: 1px solid var(--ll-border);
}
.ll-ai-context.ll-ai-show { display: flex; }
.ll-ai-context i { font-size: 0.72rem; color: var(--ll-text-soft); }
.ll-ai-context b { font-weight: 600; color: var(--ll-text-soft); }

/* ---- Thread (scrolling message list) ------------------------------------- */
.ll-ai-thread {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 18px 18px 8px;
  display: flex; flex-direction: column; gap: 16px;
  scroll-behavior: smooth;
}

/* Fresh-state greeting + suggestion chips. */
.ll-ai-greeting { padding: 6px 2px 2px; }
.ll-ai-greeting h3 {
  font-family: var(--ll-display); font-size: 1.22rem; font-weight: 650;
  letter-spacing: -0.02em; color: var(--ll-text); margin: 0 0 7px;
}
.ll-ai-greeting p {
  font-size: var(--ll-fs-md); color: var(--ll-text-soft);
  margin: 0 0 16px; line-height: 1.5; max-width: 40ch;
}
/* Onboarding greeting variant (first-login "Your journey"): the five-line
   orientation map. Same voice as the greeting; tighter type for one-liners. */
.ll-ai-onb-map {
  list-style: none; margin: 0 0 14px; padding: 10px 12px;
  background: var(--ll-bg); border: 1px solid var(--ll-border); border-radius: 9px;
}
.ll-ai-onb-map li {
  font-size: var(--ll-fs-sm); color: var(--ll-text-soft);
  line-height: 1.5; padding: 3px 0;
}
.ll-ai-onb-map li b { color: var(--ll-text); font-weight: 600; }

.ll-ai-chips { display: flex; flex-direction: column; gap: 8px; }
.ll-ai-chip {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 11px 13px; text-align: left;
  font: inherit; font-size: var(--ll-fs-sm); font-weight: 500; color: var(--ll-text-soft);
  background: var(--ll-bg); border: 1px solid var(--ll-border);
  border-radius: var(--ll-r-md); cursor: pointer;
  transition: background-color .15s var(--ll-ease), border-color .15s var(--ll-ease),
              color .15s var(--ll-ease), transform .09s var(--ll-ease);
}
.ll-ai-chip i { color: var(--ll-accent-ink); opacity: 0.7; font-size: 0.8rem; flex: none; }
@media (hover: hover) and (pointer: fine) {
  .ll-ai-chip:hover { background: var(--ll-accent-soft); border-color: var(--ll-accent-line); color: var(--ll-text); }
  .ll-ai-chip:hover i { opacity: 1; }
}
.ll-ai-chip:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ll-focus); border-color: var(--ll-accent-line); }
.ll-ai-chip:active { transform: scale(0.99); }

/* ---- Messages ------------------------------------------------------------ */
/* Each message fades + rises in via a CSS transition (interruptible), toggled
   by the .ll-ai-in class JS adds on the next frame. */
.ll-ai-msg {
  opacity: 0; transform: translateY(6px);
  transition: opacity .24s var(--ll-ease), transform .24s var(--ll-ease);
}
.ll-ai-msg.ll-ai-in { opacity: 1; transform: translateY(0); }

/* User: right-aligned bubble on accent-soft. */
.ll-ai-msg-user {
  align-self: flex-end; max-width: 86%;
  padding: 10px 13px; border-radius: 14px 14px 4px 14px;
  background: var(--ll-accent-soft); color: var(--ll-accent-ink);
  font-size: var(--ll-fs-md); line-height: 1.5; word-wrap: break-word; overflow-wrap: anywhere;
}

/* Assistant: full-width block, no bubble (reads like prose). */
.ll-ai-msg-assistant {
  align-self: stretch; max-width: 100%;
  font-size: var(--ll-fs-md); line-height: 1.6; color: var(--ll-text);
}
.ll-ai-msg-assistant > *:first-child { margin-top: 0; }
.ll-ai-msg-assistant > *:last-child { margin-bottom: 0; }
.ll-ai-msg-assistant p { margin: 0 0 10px; }
.ll-ai-msg-assistant strong { font-weight: 650; color: var(--ll-text); }
.ll-ai-msg-assistant em { font-style: italic; }
.ll-ai-msg-assistant a { color: var(--ll-green); text-decoration: none; font-weight: 500; }
.ll-ai-msg-assistant a:hover { text-decoration: underline; }
.ll-ai-msg-assistant code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.86em;
  background: var(--ll-elevated); border: 1px solid var(--ll-border);
  border-radius: 5px; padding: 1px 5px; color: var(--ll-text);
}
.ll-ai-msg-assistant pre {
  background: var(--ll-elevated); border: 1px solid var(--ll-border);
  border-radius: var(--ll-r-md); padding: 12px 14px; margin: 0 0 12px;
  overflow-x: auto;
}
.ll-ai-msg-assistant pre code { background: none; border: none; padding: 0; font-size: 0.82rem; }
.ll-ai-msg-assistant ul, .ll-ai-msg-assistant ol { margin: 0 0 12px; padding-left: 22px; }
.ll-ai-msg-assistant li { margin: 0 0 5px; }
.ll-ai-msg-assistant li:last-child { margin-bottom: 0; }

/* ---- Markdown tables (exportable) ---------------------------------------- */
/* A detected pipe table becomes a real <table>. The panel is narrow, so the
   table sits in a horizontal-scroll wrapper; a quiet toolbar (Copy TSV /
   Export CSV) sits above it. Reuses the app's .ll-table vocabulary: uppercase
   eyebrow header, zebra body, accent-tinted hover. No side-stripe borders. */
.ll-ai-tableblock { margin: 0 0 13px; }
.ll-ai-tableblock:last-child { margin-bottom: 0; }
.ll-ai-table-bar {
  display: flex; align-items: center; justify-content: flex-end; gap: 6px;
  margin-bottom: 6px;
}
.ll-ai-tablebtn {
  display: inline-flex; align-items: center; gap: 5px;
  font: inherit; font-size: var(--ll-fs-xs); font-weight: 600; line-height: 1;
  color: var(--ll-text-soft);
  background: var(--ll-panel);
  border: 1px solid var(--ll-border); border-radius: var(--ll-r-sm);
  padding: 5px 9px; cursor: pointer;
  transition: background-color .15s var(--ll-ease), border-color .15s var(--ll-ease),
              color .15s var(--ll-ease), transform .09s var(--ll-ease);
}
.ll-ai-tablebtn i { font-size: 0.82em; opacity: 0.75; }
@media (hover: hover) and (pointer: fine) {
  .ll-ai-tablebtn:hover { background: var(--ll-accent-soft); border-color: var(--ll-accent-line); color: var(--ll-text); }
  .ll-ai-tablebtn:hover i { opacity: 1; }
}
.ll-ai-tablebtn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ll-focus); border-color: var(--ll-accent-line); }
.ll-ai-tablebtn:active { transform: scale(0.96); }
/* Momentary "Copied / Saved" confirmation on the button itself. */
.ll-ai-tablebtn-done {
  color: var(--ll-success); border-color: var(--ll-success);
  background: var(--ll-success-soft);
}
.ll-ai-tablebtn-done i { opacity: 1; }

.ll-ai-tablescroll {
  overflow-x: auto; overflow-y: hidden;
  border: 1px solid var(--ll-border); border-radius: var(--ll-r-md);
  background: var(--ll-panel);
  -webkit-overflow-scrolling: touch;
}
.ll-ai-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: var(--ll-fs-sm); color: var(--ll-text);
  font-variant-numeric: tabular-nums;
}
.ll-ai-table th {
  text-align: left; white-space: nowrap;
  font-size: var(--ll-fs-xs); font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--ll-text-mute);
  background: oklch(0.975 0.006 140);
  padding: 9px 12px; border-bottom: 1px solid var(--ll-border);
}
.ll-ai-table td {
  padding: 9px 12px; border-bottom: 1px solid var(--ll-border);
  vertical-align: top; line-height: 1.45;
}
.ll-ai-table tbody tr:last-child td { border-bottom: none; }
.ll-ai-table tbody tr:nth-child(even) td { background: var(--ll-elevated); }
@media (hover: hover) and (pointer: fine) {
  .ll-ai-table tbody tr:hover td { background: var(--ll-accent-soft); }
}
.ll-ai-table code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.86em;
  background: var(--ll-elevated); border: 1px solid var(--ll-border);
  border-radius: 5px; padding: 1px 5px;
}
.ll-ai-table a { color: var(--ll-green); text-decoration: none; font-weight: 500; }
.ll-ai-table a:hover { text-decoration: underline; }

/* ===========================================================================
 * Action cards (Phase 2 — approve-then-apply)
 * A proposed write, rendered after the assistant's markdown reply. Full 1px
 * border on --ll-panel (NO side-stripe — banned), soft shadow, --ll-r-md.
 * Per-card state machine: idle -> applying -> applied | failed(->Retry);
 * money-risk detours through an inline amber confirm; reject -> dismissed(->Undo).
 * ========================================================================== */
.ll-ai-card, .ll-ai-dismissed {
  /* Enter shares the message rise; state changes are transitioned in-place. */
  opacity: 0; transform: translateY(6px);
  transition: opacity .24s var(--ll-ease), transform .24s var(--ll-ease);
}
.ll-ai-card.ll-ai-in, .ll-ai-dismissed.ll-ai-in { opacity: 1; transform: translateY(0); }
.ll-ai-card {
  align-self: stretch; max-width: 100%;
  /* Don't let the thread's flex column shrink a card below its content: it would
     squash the card and (with overflow:hidden) clip a form's fields + open menu,
     leaving nothing for the thread to scroll to. flex:none = natural height. */
  flex: none;
  border: 1px solid var(--ll-border); border-radius: var(--ll-r-md);
  background: var(--ll-panel); box-shadow: var(--ll-shadow-1);
  overflow: hidden;
}
.ll-ai-card + .ll-ai-card { margin-top: 2px; }

/* Body: title, risk badge, rationale, preview */
.ll-ai-card-body { padding: 14px 15px 13px; }
.ll-ai-card-top {
  display: flex; align-items: flex-start; gap: 10px; margin-bottom: 7px;
}
.ll-ai-card-title {
  font-family: var(--ll-display); font-size: 0.98rem; font-weight: 650;
  letter-spacing: -0.01em; line-height: 1.32; color: var(--ll-text);
  margin: 0; flex: 1; min-width: 0;
}
/* Risk badge reuses the shared .ll-badge scale/tone (defined for the card
   locally so ai-assistant.css stays self-contained off the app shell). */
.ll-ai-badge {
  flex: none; display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--ll-fs-xs); font-weight: 600; line-height: 1;
  letter-spacing: 0.01em; white-space: nowrap;
  padding: 4px 9px; border-radius: var(--ll-r-pill);
  margin-top: 1px;
}
.ll-ai-badge i { font-size: 0.72em; }
.ll-ai-badge-low   { color: var(--ll-success); background: var(--ll-success-soft); }
.ll-ai-badge-money { color: var(--ll-warn);    background: var(--ll-warn-soft); }
.ll-ai-badge-done  { color: var(--ll-success); background: var(--ll-success-soft); }
/* Destructive (create/delete): the strongest pre-apply tier. A filled danger
   badge reads louder than money's soft tint so it stands out on the card top. */
.ll-ai-badge-destructive {
  color: oklch(0.99 0.01 27); background: var(--ll-danger);
  box-shadow: 0 0 0 1px var(--ll-danger);
}

/* Applied-state card (auto-run action). Renders terminal on arrival: full
   context (title/rationale/preview) + the shared applied footer, NO Accept/
   Reject. A hairline accent on the top edge (full-width, NOT a side stripe)
   plus a paper-tinted body distinguish "already done" from a pending proposal. */
.ll-ai-card-applied { border-color: var(--ll-success); }
.ll-ai-card-applied .ll-ai-card-body { background: oklch(0.985 0.012 145); }
.ll-ai-card-applied .ll-ai-card-title { color: var(--ll-text); }

.ll-ai-card-rationale {
  font-size: var(--ll-fs-sm); line-height: 1.5; color: var(--ll-text-soft);
  margin: 0 0 12px;
}
.ll-ai-card-rationale:last-child { margin-bottom: 0; }

/* before -> after mini-panel. FULL 1px border, EQUAL on all sides (guards the
   no-side-stripe ban). Never a colored left/right accent. */
.ll-ai-preview {
  border: 1px solid var(--ll-border); border-radius: var(--ll-r-sm);
  background: var(--ll-elevated);
  padding: 10px 12px; margin-bottom: 13px;
}
.ll-ai-preview-summary {
  font-size: var(--ll-fs-sm); font-weight: 550; color: var(--ll-text);
  line-height: 1.45;
}
.ll-ai-preview-delta {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}
.ll-ai-preview-val {
  font-size: var(--ll-fs-sm); font-weight: 550;
  padding: 3px 8px; border-radius: 6px;
  background: var(--ll-panel); border: 1px solid var(--ll-border);
  overflow-wrap: anywhere;
}
.ll-ai-preview-before { color: var(--ll-text-mute); }
.ll-ai-preview-after  { color: var(--ll-text); border-color: var(--ll-accent-line); }
.ll-ai-preview-arrow {
  color: var(--ll-text-mute); font-size: 0.78rem; flex: none;
}

/* Action row: Accept (primary) + Reject (ghost). Small buttons. */
.ll-ai-card-actions {
  display: flex; align-items: center; gap: 8px; margin-top: 2px;
}
.ll-ai-cardbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: inherit; font-size: var(--ll-fs-sm); font-weight: 550; line-height: 1;
  padding: 8px 13px; border-radius: var(--ll-r-sm);
  border: 1px solid transparent; cursor: pointer;
  transition: background-color .16s var(--ll-ease), border-color .16s var(--ll-ease),
              color .16s var(--ll-ease), transform .09s var(--ll-ease), opacity .16s var(--ll-ease);
}
.ll-ai-cardbtn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ll-focus); }
.ll-ai-cardbtn:active { transform: scale(0.97); }
.ll-ai-cardbtn-accept {
  background: var(--ll-green); color: var(--ll-on-green); box-shadow: var(--ll-shadow-1);
}
.ll-ai-cardbtn-accept:hover { background: var(--ll-green-hover); }
.ll-ai-cardbtn-reject { background: transparent; color: var(--ll-text-soft); border-color: var(--ll-border-strong); }
.ll-ai-cardbtn-reject:hover { background: var(--ll-elevated); color: var(--ll-text); }
.ll-ai-cardbtn:disabled { cursor: not-allowed; opacity: 0.55; transform: none; }
.ll-ai-cardbtn:disabled:hover { background: var(--ll-green); }        /* accept keeps its fill while busy */
.ll-ai-cardbtn-reject:disabled:hover { background: transparent; color: var(--ll-text-soft); }

/* Spinner (accept in flight) — reuses the button text slot. */
.ll-ai-spin {
  width: 13px; height: 13px; flex: none;
  border: 2px solid oklch(0.99 0.01 152 / 0.35);
  border-top-color: var(--ll-on-green);
  border-radius: 50%;
  animation: ll-ai-spin 0.6s linear infinite;
}
@keyframes ll-ai-spin { to { transform: rotate(360deg); } }

/* Money-risk inline confirm strip (amber, NOT a modal). Slides in place of
   the normal actions when Accept is pressed on a money card. */
.ll-ai-confirm {
  border-top: 1px solid var(--ll-warn-soft);
  background: var(--ll-warn-soft);
  padding: 11px 15px 13px;
}
.ll-ai-confirm-msg {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: var(--ll-fs-sm); font-weight: 550; color: var(--ll-warn);
  line-height: 1.4; margin-bottom: 10px;
}
.ll-ai-confirm-msg i { flex: none; margin-top: 1px; }
.ll-ai-confirm-actions { display: flex; align-items: center; gap: 8px; }
.ll-ai-cardbtn-confirm {
  background: var(--ll-warn); color: oklch(0.99 0.01 80); border-color: var(--ll-warn);
}
.ll-ai-cardbtn-confirm:hover { background: oklch(0.49 0.12 70); }
.ll-ai-cardbtn-confirm:disabled:hover { background: var(--ll-warn); }
.ll-ai-cardbtn-cancel { background: transparent; color: var(--ll-warn); border-color: transparent; }
.ll-ai-cardbtn-cancel:hover { background: oklch(0.9 0.06 80); }

/* Destructive variant of the inline confirm: danger tone, since create/delete
   is at least as sensitive as money. Reuses the same confirm layout. */
.ll-ai-confirm-destructive { border-top-color: var(--ll-danger-soft); background: var(--ll-danger-soft); }
.ll-ai-confirm-destructive .ll-ai-confirm-msg { color: var(--ll-danger); }
.ll-ai-confirm-destructive .ll-ai-cardbtn-confirm {
  background: var(--ll-danger); color: oklch(0.99 0.01 27); border-color: var(--ll-danger);
}
.ll-ai-confirm-destructive .ll-ai-cardbtn-confirm:hover { background: oklch(0.5 0.17 27); }
.ll-ai-confirm-destructive .ll-ai-cardbtn-confirm:disabled:hover { background: var(--ll-danger); }
.ll-ai-confirm-destructive .ll-ai-cardbtn-cancel { color: var(--ll-danger); }
.ll-ai-confirm-destructive .ll-ai-cardbtn-cancel:hover { background: oklch(0.92 0.04 27); }

/* Applied — success footer. A crossfade (opacity + tiny blur) masks the swap
   from the action row so the two states don't visibly overlap (Emil). */
.ll-ai-applied {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 12px 15px; border-top: 1px solid var(--ll-border);
  background: var(--ll-success-soft);
}
.ll-ai-applied-check {
  flex: none; width: 18px; height: 18px; margin-top: 1px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--ll-success); color: oklch(0.99 0.01 145);
  font-size: 0.66rem;
}
.ll-ai-applied-body { min-width: 0; flex: 1; }
.ll-ai-applied-summary { font-size: var(--ll-fs-sm); font-weight: 550; color: var(--ll-text); line-height: 1.45; }
/* Meta row under the summary: "View change" audit link + the quiet Undo.
   Space-between so Undo sits at the trailing edge, away from the link. */
.ll-ai-applied-meta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-top: 6px; flex-wrap: wrap;
}
.ll-ai-applied-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--ll-fs-xs); font-weight: 600; color: var(--ll-green);
  text-decoration: none;
}
.ll-ai-applied-link:hover { text-decoration: underline; }
.ll-ai-applied-link i { font-size: 0.72em; }
/* When there's no audit link, Undo still hugs the trailing edge. */
.ll-ai-applied-meta > .ll-ai-undo-btn:only-child { margin-left: auto; }

/* Quiet, small secondary control (mirrors ui.css .ll-btn-subtle .ll-btn-sm,
   redeclared locally so the panel stands alone off the app shell). Used for
   Undo on an applied card + the conflict/dismiss controls. */
.ll-ai-btn-subtle {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: inherit; font-weight: 600; line-height: 1;
  color: var(--ll-text-soft);
  background: transparent; border: 1px solid transparent;
  border-radius: var(--ll-r-sm); cursor: pointer; text-decoration: none;
  transition: background-color .15s var(--ll-ease), color .15s var(--ll-ease),
              transform .09s var(--ll-ease);
}
.ll-ai-btn-subtle i { font-size: 0.82em; opacity: 0.85; }
.ll-ai-btn-sm { padding: 5px 9px; font-size: var(--ll-fs-xs); }
@media (hover: hover) and (pointer: fine) {
  .ll-ai-btn-subtle:hover { background: var(--ll-elevated); color: var(--ll-text); }
  .ll-ai-btn-subtle:hover i { opacity: 1; }
}
.ll-ai-btn-subtle:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ll-focus); }
.ll-ai-btn-subtle:active { transform: scale(0.97); }
.ll-ai-btn-subtle:disabled { cursor: not-allowed; opacity: 0.5; transform: none; }
/* Undo reads in the app green so it registers as the reversible affordance,
   not a destructive one. */
.ll-ai-undo-btn { color: var(--ll-green); }
.ll-ai-undo-btn i { opacity: 0.9; }
@media (hover: hover) and (pointer: fine) {
  .ll-ai-undo-btn:hover { background: var(--ll-accent-soft); color: var(--ll-green); }
}

/* Dark-on-light spinner variant (the undoing spinner sits on the light success
   footer, where the on-green spinner would vanish). */
.ll-ai-spin-ink {
  border-color: oklch(0.58 0.13 150 / 0.28);
  border-top-color: var(--ll-green);
}

/* Undone — terminal reverted footer. Neutral/paper, calmer than the success
   green: the change is gone, so this shouldn't celebrate. Full-width top border
   (no side stripe). */
.ll-ai-undone {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 12px 15px; border-top: 1px solid var(--ll-border);
  background: var(--ll-elevated);
}
.ll-ai-undone-mark {
  flex: none; width: 18px; height: 18px; margin-top: 1px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--ll-text-mute); color: var(--ll-panel);
  font-size: 0.6rem;
}
.ll-ai-undone-summary { font-size: var(--ll-fs-sm); font-weight: 550; color: var(--ll-text-soft); line-height: 1.45; }
/* An undone card sheds the applied green accent + paper tint (it's neutral now). */
.ll-ai-card-undone { border-color: var(--ll-border); }
.ll-ai-card-undone .ll-ai-card-body { background: var(--ll-panel); }
.ll-ai-badge-undone { color: var(--ll-text-mute); background: var(--ll-elevated); }

/* Conflict — the entity drifted; auto-revert is unsafe. Calm ATTENTION tone
   (amber/warn, the system's "heads up, not broken" color — same family as the
   money confirm), never a red error: nothing failed, the change simply stands. */
.ll-ai-card-conflict { border-color: var(--ll-warn); }
.ll-ai-conflict {
  padding: 12px 15px; border-top: 1px solid var(--ll-warn-soft);
  background: var(--ll-warn-soft);
}
.ll-ai-conflict-msg {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: var(--ll-fs-sm); color: var(--ll-warn); line-height: 1.5;
  margin-bottom: 10px;
}
.ll-ai-conflict-msg i { flex: none; margin-top: 2px; }
.ll-ai-conflict-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
/* Inside the amber strip, keep the subtle controls legible on the tint. */
.ll-ai-conflict-actions .ll-ai-btn-subtle { color: var(--ll-warn); }
@media (hover: hover) and (pointer: fine) {
  .ll-ai-conflict-actions .ll-ai-btn-subtle:hover { background: oklch(0.9 0.06 80); color: var(--ll-warn); }
}

/* Failed — inline error footer with Retry + Dismiss (no toast spam). */
.ll-ai-cardfail {
  padding: 12px 15px; border-top: 1px solid var(--ll-danger-soft);
  background: var(--ll-danger-soft);
}
.ll-ai-cardfail-msg {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: var(--ll-fs-sm); color: var(--ll-danger); line-height: 1.45;
  margin-bottom: 10px;
}
.ll-ai-cardfail-msg i { flex: none; margin-top: 1px; }
.ll-ai-cardfail-actions { display: flex; align-items: center; gap: 8px; }
.ll-ai-cardbtn-retry { background: var(--ll-danger); color: oklch(0.99 0.01 27); border-color: var(--ll-danger); }
.ll-ai-cardbtn-retry:hover { background: oklch(0.5 0.17 27); }
.ll-ai-cardbtn-retry:disabled:hover { background: var(--ll-danger); }
.ll-ai-cardbtn-dismiss { background: transparent; color: var(--ll-danger); border-color: transparent; }
.ll-ai-cardbtn-dismiss:hover { background: oklch(0.92 0.035 27); }

/* Dismissed — collapsed stub with a local Undo (no server un-dismiss). */
.ll-ai-dismissed {
  align-self: stretch; max-width: 100%;
  display: flex; align-items: center; gap: 9px;
  padding: 10px 13px; border: 1px solid var(--ll-border);
  border-radius: var(--ll-r-md); background: var(--ll-elevated);
}
.ll-ai-dismissed i { flex: none; color: var(--ll-text-mute); font-size: 0.82rem; }
.ll-ai-dismissed-label {
  flex: 1; min-width: 0; font-size: var(--ll-fs-sm); color: var(--ll-text-mute);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ll-ai-dismissed-label b { font-weight: 600; color: var(--ll-text-soft); }
.ll-ai-undo {
  flex: none; font: inherit; font-size: var(--ll-fs-sm); font-weight: 600;
  background: none; border: none; color: var(--ll-green); cursor: pointer;
  padding: 3px 6px; border-radius: var(--ll-r-sm);
  transition: color .14s var(--ll-ease), background-color .14s var(--ll-ease);
}
.ll-ai-undo:hover { background: var(--ll-accent-soft); }
.ll-ai-undo:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ll-focus); }

/* Footer regions crossfade in when they replace the action row. */
.ll-ai-cardfoot-in {
  animation: ll-ai-cardfoot-in .26s var(--ll-ease);
}
@keyframes ll-ai-cardfoot-in {
  from { opacity: 0; filter: blur(2px); }
  to   { opacity: 1; filter: blur(0); }
}

/* ===========================================================================
 * Interactive parameter pickers (form_request)
 * A form card, sibling to the action card (same 1px-border-on-panel chrome, NO
 * side stripe). The `note` is a lede, then one control per field, then a
 * Continue/Cancel footer. Entity fields are click-to-open searchable comboboxes
 * that lazy-load; dependent fields disable until their parent is chosen.
 * ========================================================================== */
.ll-ai-form .ll-ai-badge-form {
  color: var(--ll-accent-ink); background: var(--ll-accent-soft);
}

/* Field stack */
.ll-ai-form-fields { display: flex; flex-direction: column; gap: 13px; margin-top: 4px; }
.ll-ai-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.ll-ai-field-label {
  display: flex; align-items: baseline; gap: 6px;
  font-size: var(--ll-fs-xs); font-weight: 600; letter-spacing: 0.01em;
  color: var(--ll-text-soft);
}
.ll-ai-req { color: var(--ll-danger); font-weight: 700; }
.ll-ai-optional {
  margin-left: auto; font-size: var(--ll-fs-xs); font-weight: 500;
  color: var(--ll-text-mute); letter-spacing: 0;
}
.ll-ai-field-help {
  margin: 0; font-size: var(--ll-fs-xs); color: var(--ll-text-mute); line-height: 1.4;
}

/* Shared control chrome (text / number / native select / combo trigger). */
.ll-ai-control {
  width: 100%; font: inherit; font-size: var(--ll-fs-sm); color: var(--ll-text);
  padding: 9px 11px; border: 1px solid var(--ll-border); border-radius: var(--ll-r-sm);
  background: var(--ll-bg);
  transition: border-color .14s var(--ll-ease), box-shadow .14s var(--ll-ease);
}
.ll-ai-text::placeholder { color: var(--ll-text-mute); }
.ll-ai-control:focus,
.ll-ai-control:focus-visible {
  outline: none; border-color: var(--ll-accent-line); box-shadow: 0 0 0 3px var(--ll-focus);
}
.ll-ai-select { -webkit-appearance: none; appearance: none; cursor: pointer;
  /* caret glyph without an external asset (tinted to the muted ink) */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5L6 8l3.5-3.5' fill='none' stroke='%23708573' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px;
}

/* ---- Combobox (entity picker) ------------------------------------------- */
.ll-ai-combo { position: relative; min-width: 0; }
.ll-ai-combo-trigger {
  display: flex; align-items: center; gap: 8px; text-align: left; cursor: pointer;
}
.ll-ai-combo-val {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ll-ai-combo-placeholder { color: var(--ll-text-mute); }
.ll-ai-combo-hasval .ll-ai-combo-val { color: var(--ll-text); font-weight: 500; }
.ll-ai-combo-caret {
  flex: none; color: var(--ll-text-mute); font-size: 0.7rem; line-height: 0;
  transition: transform .18s var(--ll-ease), color .14s var(--ll-ease);
}
.ll-ai-combo-open .ll-ai-combo-caret { transform: rotate(180deg); color: var(--ll-text-soft); }
.ll-ai-combo-disabled .ll-ai-combo-trigger,
.ll-ai-combo-trigger:disabled {
  cursor: not-allowed; opacity: 0.6; background: var(--ll-elevated);
}

/* Popover: opens IN FLOW (not absolute), so it takes real vertical space and
   grows the card, letting the scrollable thread reveal it (a bottom-field menu
   is reachable by scrolling). Reveal is a max-height + opacity transition; when
   closed it collapses to nothing with no stray border/shadow/margin. Long lists
   scroll inside `.ll-ai-combo-list`. */
.ll-ai-combo-pop {
  display: flex; flex-direction: column;
  max-height: 0; overflow: hidden;
  margin-top: 0; border: 0; border-radius: var(--ll-r-md);
  background: var(--ll-panel); box-shadow: none;
  opacity: 0; pointer-events: none;
  transition: max-height .2s var(--ll-ease), opacity .16s var(--ll-ease),
              margin-top .2s var(--ll-ease);
}
.ll-ai-combo-open .ll-ai-combo-pop {
  max-height: 300px; margin-top: 5px;
  border: 1px solid var(--ll-border-strong); box-shadow: var(--ll-shadow-2);
  opacity: 1; pointer-events: auto;
}
.ll-ai-combo-searchwrap {
  display: flex; align-items: center; gap: 8px; flex: none;
  padding: 8px 10px; border-bottom: 1px solid var(--ll-border);
}
.ll-ai-combo-searchicon { flex: none; color: var(--ll-text-mute); font-size: 0.78rem; line-height: 0; }
.ll-ai-combo-search {
  flex: 1; min-width: 0; border: none; outline: none; background: transparent;
  font: inherit; font-size: var(--ll-fs-sm); color: var(--ll-text); padding: 2px 0;
}
.ll-ai-combo-search::placeholder { color: var(--ll-text-mute); }

.ll-ai-combo-list {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 5px; -webkit-overflow-scrolling: touch;
}
.ll-ai-combo-opt {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 9px; border-radius: var(--ll-r-sm); cursor: pointer;
  scroll-margin: 5px;
}
.ll-ai-combo-optname {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: var(--ll-fs-sm); color: var(--ll-text);
}
.ll-ai-combo-optid {
  flex: none; font-size: var(--ll-fs-xs); color: var(--ll-text-mute);
  font-variant-numeric: tabular-nums;
}
.ll-ai-combo-optcheck { flex: none; color: var(--ll-green); font-size: 0.72rem; line-height: 0; }
/* Active row = keyboard/pointer focus (accent-soft, matching chip/table hover). */
.ll-ai-combo-opt-active { background: var(--ll-accent-soft); }
.ll-ai-combo-opt-active .ll-ai-combo-optname { color: var(--ll-text); }
.ll-ai-combo-opt-selected .ll-ai-combo-optname { font-weight: 600; }

/* Loading / error / empty states inside the popover. */
.ll-ai-combo-status {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 14px 12px; font-size: var(--ll-fs-sm); color: var(--ll-text-soft);
}
.ll-ai-combo-status .ll-ai-spin { width: 14px; height: 14px; }
.ll-ai-combo-status-err { color: var(--ll-danger); }
.ll-ai-combo-status-err i { flex: none; }
.ll-ai-combo-retry {
  margin-left: auto; font: inherit; font-size: var(--ll-fs-xs); font-weight: 600;
  background: none; border: none; color: var(--ll-green); cursor: pointer;
  padding: 3px 6px; border-radius: var(--ll-r-sm);
}
.ll-ai-combo-retry:hover { background: var(--ll-accent-soft); }
.ll-ai-combo-empty { color: var(--ll-text-mute); justify-content: center; }
.ll-ai-combo-emptylist { flex-direction: column; align-items: flex-start; gap: 9px; }
.ll-ai-combo-createlink {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--ll-fs-sm); font-weight: 600; color: var(--ll-green); text-decoration: none;
}
.ll-ai-combo-createlink:hover { text-decoration: underline; }
.ll-ai-combo-createlink i { font-size: 0.8em; }

/* Footer: Continue + Cancel. Continue disables until required are filled. */
.ll-ai-form-actions { margin-top: 4px; padding: 0 15px 14px; }
.ll-ai-form .ll-ai-card-foot { padding: 0; }
.ll-ai-cardbtn-label { display: inline-flex; align-items: center; gap: 7px; }

/* Submitted / cancelled / expired stub (the collapsed form). */
.ll-ai-form-stub {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 15px;
}
.ll-ai-form-stub-mark {
  flex: none; width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 0.68rem;
}
.ll-ai-form-stub-submitted { background: var(--ll-success); color: oklch(0.99 0.01 145); }
.ll-ai-form-stub-cancelled { background: var(--ll-text-mute); color: var(--ll-panel); }
.ll-ai-form-stub-stale { background: var(--ll-elevated); color: var(--ll-text-mute); box-shadow: inset 0 0 0 1px var(--ll-border); }
.ll-ai-form-stub-text { font-size: var(--ll-fs-sm); font-weight: 550; color: var(--ll-text-soft); line-height: 1.4; }
.ll-ai-form-stubcard { background: var(--ll-elevated); }
.ll-ai-form-sending .ll-ai-form-stub .ll-ai-applied-check { background: transparent; }

/* ---- Thinking indicator -------------------------------------------------- */
.ll-ai-thinking {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 14px; border-radius: 14px 14px 14px 4px;
  background: var(--ll-elevated); border: 1px solid var(--ll-border);
}
.ll-ai-thinking .ll-ai-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--ll-text-mute);
  animation: ll-ai-blink 1.2s var(--ll-ease) infinite;
}
.ll-ai-thinking .ll-ai-dot:nth-child(2) { animation-delay: 0.18s; }
.ll-ai-thinking .ll-ai-dot:nth-child(3) { animation-delay: 0.36s; }
@keyframes ll-ai-blink {
  0%, 60%, 100% { opacity: 0.28; transform: translateY(0); }
  30%           { opacity: 1;    transform: translateY(-2px); }
}

/* ---- Inline error row (send failed) -------------------------------------- */
.ll-ai-error {
  align-self: stretch; display: flex; align-items: center; gap: 9px;
  padding: 10px 12px; border-radius: var(--ll-r-md);
  background: var(--ll-danger-soft); color: var(--ll-danger);
  font-size: var(--ll-fs-sm);
}
.ll-ai-error i { flex: none; }
.ll-ai-error button {
  margin-left: auto; font: inherit; font-size: var(--ll-fs-sm); font-weight: 600;
  background: none; border: none; color: var(--ll-danger); cursor: pointer;
  text-decoration: underline; padding: 2px 4px; border-radius: var(--ll-r-sm);
}
.ll-ai-error button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ll-danger-soft); }

/* ---- Quiet "couldn't auto-continue" note --------------------------------- */
/* The create already succeeded, so a failed follow-through is informational,
   not an error: muted text on the elevated surface, a full (non-side-stripe)
   border, no action button, no toast. Fades + rises in like a message. */
.ll-ai-continuefail {
  align-self: stretch; display: flex; align-items: flex-start; gap: 8px;
  padding: 8px 11px; border-radius: var(--ll-r-md);
  background: var(--ll-elevated); border: 1px solid var(--ll-border);
  color: var(--ll-text-mute); font-size: var(--ll-fs-xs); line-height: 1.45;
  opacity: 0; transform: translateY(6px);
  transition: opacity .24s var(--ll-ease), transform .24s var(--ll-ease);
}
.ll-ai-continuefail.ll-ai-in { opacity: 1; transform: translateY(0); }
.ll-ai-continuefail i { flex: none; margin-top: 1px; color: var(--ll-text-soft); font-size: 0.78rem; }

/* ---- Composer ------------------------------------------------------------ */
.ll-ai-composer {
  flex: none; padding: 12px 14px;
  border-top: 1px solid var(--ll-border); background: var(--ll-panel);
}
.ll-ai-inputwrap {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 8px 8px 8px 12px;
  border: 1px solid var(--ll-border); border-radius: var(--ll-r-md);
  background: var(--ll-bg);
  transition: border-color .14s var(--ll-ease), box-shadow .14s var(--ll-ease);
}
.ll-ai-inputwrap.ll-ai-focus { border-color: var(--ll-accent-line); box-shadow: 0 0 0 3px var(--ll-focus); }
.ll-ai-input {
  flex: 1; min-width: 0; border: none; outline: none; resize: none;
  background: transparent; font: inherit; font-size: var(--ll-fs-md);
  color: var(--ll-text); line-height: 1.5;
  max-height: 132px; overflow-y: auto;
  padding: 5px 0;
}
.ll-ai-input::placeholder { color: var(--ll-text-mute); }
.ll-ai-send {
  flex: none; width: 34px; height: 34px; border-radius: var(--ll-r-sm);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ll-green); color: var(--ll-on-green); border: none;
  cursor: pointer; font-size: 0.85rem;
  transition: background-color .16s var(--ll-ease), transform .08s var(--ll-ease), opacity .16s var(--ll-ease);
}
.ll-ai-send:hover { background: var(--ll-green-hover); }
.ll-ai-send:active { transform: scale(0.94); }
.ll-ai-send:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ll-focus); }
.ll-ai-send:disabled { background: var(--ll-elevated); color: var(--ll-text-mute); cursor: not-allowed; }

/* ---- Foot: quiet "Powered by LimeliChat" --------------------------------- */
.ll-ai-foot {
  flex: none; padding: 9px 16px 11px; text-align: center;
  border-top: 1px solid var(--ll-border); background: var(--ll-panel);
}
.ll-ai-foot a {
  font-size: var(--ll-fs-xs); color: var(--ll-text-mute); text-decoration: none;
  transition: color .14s var(--ll-ease);
}
.ll-ai-foot a b { font-weight: 600; color: var(--ll-text-soft); }
.ll-ai-foot a:hover { color: var(--ll-text-soft); }
.ll-ai-foot a:hover b { color: var(--ll-green); }

/* ---- Per-reply thumbs feedback ------------------------------------------- */
/* Quiet by design: hidden until the reply is hovered or keyboard-focused, and
   pinned visible once a rating exists. Ghost icon buttons; the pressed state
   wears the accent-soft chip treatment (same selection vocabulary as chips). */
.ll-ai-feedback {
  display: flex; align-items: center; flex-wrap: wrap; gap: 2px;
  margin-top: 8px;
  opacity: 0;
  transition: opacity .15s var(--ll-ease);
}
.ll-ai-msg-assistant:hover .ll-ai-feedback,
.ll-ai-msg-assistant:focus-within .ll-ai-feedback,
.ll-ai-feedback.ll-ai-fb-rated { opacity: 1; }
.ll-ai-fbbtn {
  width: 26px; height: 26px; border-radius: var(--ll-r-sm);
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent; cursor: pointer;
  color: var(--ll-text-mute); font-size: 0.76rem; line-height: 0;
  transition: background-color .15s var(--ll-ease), color .15s var(--ll-ease);
}
@media (hover: hover) {
  .ll-ai-fbbtn:hover { background: var(--ll-elevated); color: var(--ll-text-soft); }
}
.ll-ai-fbbtn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ll-focus); }
.ll-ai-fbbtn[aria-pressed="true"] { background: var(--ll-accent-soft); color: var(--ll-accent-ink); }
/* Touch devices have no hover: keep the row always visible (still quiet). */
@media (hover: none) {
  .ll-ai-feedback { opacity: 1; }
}
/* Thumbs-down optional comment: one quiet line, borrows the composer's field
   treatment; Send is the subtle text-button vocabulary, not a primary action. */
.ll-ai-fbcomment {
  flex-basis: 100%;
  display: flex; align-items: center; gap: 6px;
  margin-top: 6px;
}
.ll-ai-fbcomment input {
  flex: 1; min-width: 0;
  font: inherit; font-size: var(--ll-fs-sm); color: var(--ll-text);
  background: var(--ll-bg); border: 1px solid var(--ll-border);
  border-radius: var(--ll-r-sm); padding: 6px 10px;
  transition: border-color .14s var(--ll-ease), box-shadow .14s var(--ll-ease);
}
.ll-ai-fbcomment input::placeholder { color: var(--ll-text-mute); }
.ll-ai-fbcomment input:focus { outline: none; border-color: var(--ll-accent-line); box-shadow: 0 0 0 3px var(--ll-focus); }
.ll-ai-fbsend {
  flex: none; border: none; background: transparent; cursor: pointer;
  font: inherit; font-size: var(--ll-fs-sm); font-weight: 600;
  color: var(--ll-green); padding: 6px 8px; border-radius: var(--ll-r-sm);
  transition: background-color .15s var(--ll-ease);
}
@media (hover: hover) {
  .ll-ai-fbsend:hover { background: var(--ll-accent-soft); }
}
.ll-ai-fbsend:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ll-focus); }

/* ---- Mobile: full-width panel + scrim ------------------------------------ */
@media (max-width: 640px) {
  .ll-ai-panel { width: 100vw; border-left: none; }
  .ll-ai-open ~ .ll-ai-scrim,
  .ll-ai-scrim.ll-ai-scrim-on { opacity: 1; pointer-events: auto; background: oklch(0.22 0.04 156 / 0.42); }
  .ll-ai-launcher { right: 16px; bottom: 16px; }
}

/* ---- Reduced motion ------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .ll-ai-panel, .ll-ai-scrim, .ll-ai-launcher, .ll-ai-chip, .ll-ai-send,
  .ll-ai-headbtn, .ll-ai-inputwrap, .ll-ai-foot a,
  .ll-ai-cardbtn, .ll-ai-undo, .ll-ai-btn-subtle, .ll-ai-tablebtn,
  .ll-ai-control, .ll-ai-combo-caret,
  .ll-ai-feedback, .ll-ai-fbbtn, .ll-ai-fbsend, .ll-ai-fbcomment input { transition: none; }
  .ll-ai-msg, .ll-ai-card, .ll-ai-continuefail { transition: opacity .18s ease; transform: none; }   /* fade only, no motion */
  .ll-ai-msg.ll-ai-in, .ll-ai-card.ll-ai-in, .ll-ai-continuefail.ll-ai-in { transform: none; }
  .ll-ai-launcher:active, .ll-ai-send:active, .ll-ai-chip:active,
  .ll-ai-cardbtn:active, .ll-ai-btn-subtle:active, .ll-ai-tablebtn:active { transform: none; }
  /* Combobox popover: reveal instantly (no max-height animation), fade only. */
  .ll-ai-combo-pop { transition: opacity .14s ease; }
  .ll-ai-combo-open .ll-ai-combo-caret { transform: none; }
  .ll-ai-thinking .ll-ai-dot { animation: ll-ai-blink-rm 1.2s ease infinite; }
  @keyframes ll-ai-blink-rm { 0%,60%,100% { opacity: 0.3; } 30% { opacity: 1; } }
  /* Keep the spinner (it aids comprehension) but drop the card-foot blur/fade. */
  .ll-ai-cardfoot-in { animation: none; }
}
