/* Hallmark · v2.0.0 · shape: app screen · scope: app · theme: the project's own (Guará Admin app.css + admin-plus.css tokens, Hanken Grotesk) · deal: none, extension of an existing console · signature: the shared green send button and the reply-card layout already used by Messaggi */
/* critique: an order-driven page inside an existing console, so no new palette, face, radius or layout grammar: cards, chips, badges, modal, list items and the green send button are the console's own; the only new pieces are the two engine choices (radio cards built from .card tokens, selected state = the console's own --accent-soft and --accent, like the selected menu item) and a neutral engine tag; no dark surface, no brown (the console's brownish "cancelled" badge is deliberately not used for cancelled requests: grey "closed" instead) */
/* Hallmark · waive 24b · whole add-on · spacing follows the console's existing rhythm (6, 10, 14, 22px) so the new cards line up with the old ones */
/* answered: F16 browser surfaces are inherited from app.css, not re-themed in an add-on */
:root {
  --ai-tag-bg: var(--line-2);
  --ai-tag-ink: var(--ink-2);
  --ai-sel-bg: var(--accent-soft);
  --ai-sel-line: var(--accent);
  --ai-ok-ink: var(--ch-wa-ink, #0b6b0b);
}

.ai-wrap { display: grid; gap: 16px; max-width: 920px; }
.ai-step { margin: 4px 0 14px; }
.ai-step > .lbl { margin-bottom: 8px; font-size: 13.5px; color: var(--ink-2); }
.ai-chips .chip { min-height: 44px; padding: 8px 16px; font-size: 14px; }
.ai-desc { margin: 8px 0 0; }
.ai-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 0 14px; }
.ai-fields select, .ai-fields input { min-height: 44px; font-size: 15px; }
.ai-text { font-size: 13.5px; }
.ai-text .row { gap: 6px; }
.ai-in { width: 100%; min-height: 170px; font: inherit; font-size: 15px; line-height: 1.5; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; resize: vertical; color: var(--ink); background: var(--card); }

/* chi la fa: due scelte grandi */
.ai-engs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ai-eng { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--card); cursor: pointer; min-height: 96px; transition: border-color var(--dur-micro), background-color var(--dur-micro); }
.ai-eng:hover { border-color: var(--ink-3); }
.ai-eng:active { border-color: var(--ai-sel-line); }
.ai-eng.on { background: var(--ai-sel-bg); border-color: var(--ai-sel-line); box-shadow: inset 0 0 0 1px var(--ai-sel-line); }
.ai-eng-b { flex: 1; min-width: 0; }
.ai-eng-b b { font-size: 15.5px; }
.ai-eng-b p { margin: 6px 0 0; }
.ai-radio { flex: none; width: 20px; height: 20px; margin-top: 2px; border-radius: 50%; border: 2px solid var(--ink-3); background: var(--card); }
.ai-eng.on .ai-radio { border-color: var(--ai-sel-line); box-shadow: inset 0 0 0 4px var(--card); background: var(--ai-sel-line); }
.ai-lvl { margin-top: 8px; font-weight: 600; color: var(--ink-2); }
.ai-lvl select { min-height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; background: var(--card); font: inherit; font-weight: 400; }

/* storico */
.eng-tag { display: inline-flex; align-items: center; border-radius: 99px; padding: 2px 10px; font-size: 12.5px; font-weight: 600; white-space: nowrap; background: var(--ai-tag-bg); color: var(--ai-tag-ink); }
.ai-item .h { row-gap: 6px; }
.ai-title { font-size: 14.5px; color: var(--ink); margin: 6px 0 4px; overflow-wrap: anywhere; }
.ai-item-f { margin-top: 2px; }
.ai-item-f .btn { min-height: 40px; }
.ai-ds .card-head { margin-bottom: 4px; }
.ai-ds-n { margin: 0; font-size: 15px; color: var(--ink-2); }
.ai-ds-n b { font-size: 22px; color: var(--ink); margin-right: 4px; }

/* dettaglio */
.ai-meta { margin-bottom: 8px; }
.ai-req { margin-top: 4px; }
.ai-req .econ-sum { max-height: 220px; overflow: auto; margin-top: 8px; font-size: 14px; }
.ai-out { max-height: 50vh; overflow: auto; }
.ai-live { min-height: 90px; color: var(--ink-2); }
.ai-out-ta { min-height: 260px; }
.ai-out-ta[readonly] { background: var(--bg); }
.ai-ok { display: flex; gap: 6px; align-items: center; color: var(--ai-ok-ink); font-weight: 600; margin: 4px 0 0; }
.ai-clip { position: fixed; inset-inline-start: -9999px; inset-block-start: 0; opacity: 0; }

/* stati */
.ai-eng:focus-visible, .ai-chips .chip:focus-visible, .ai-in:focus-visible, .ai-lvl select:focus-visible, .ai-fields select:focus-visible, .ai-fields input:focus-visible, .ai-item-f .btn:focus-visible, .ai-req summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; transition: none; }
@media (prefers-reduced-motion: reduce) { .ai-eng { transition: none; } }

/* telefono */
@media (max-width: 820px) {
  .ai-engs { grid-template-columns: minmax(0, 1fr); }
  .ai-item-f .btn { flex: 1 1 100%; justify-content: center; min-height: 44px; }
  .ai-out-ta { min-height: 200px; }
}
.ai-prog { margin: 10px 0 6px; color: var(--ink-2); font-weight: 600; }
.ai-detail .msg-actions .btn.big { white-space: normal; max-width: 100%; text-align: center; }
.ai-ds .card-head .btn { min-height: 44px; }
