/* «AI administrator» (spec docs/ai-admin-plan.md, picture D): the talks on the left, the one read on the right — the
   client's words on the right in the business's colour, the AI's on the left; on a phone the list, then the talk alone. */
.ai-head { margin-bottom: 14px; }
.ai-head__title { font: var(--display-weight) 22px/1.2 var(--font-display); letter-spacing: var(--display-tracking); }
.ai-head__text .muted { margin-top: 4px; max-width: 62ch; font-size: 14px; }
.ai-kpis { grid-template-columns: repeat(3, 1fr); align-self: start; margin-bottom: 14px; }
.ai-kpis > div:nth-child(n) { border-left: 1px solid var(--line); border-top: 0; }
.ai-kpis > div:first-child { border-left: 0; }
.ai-kpis small { margin-left: 4px; font-size: 13px; color: var(--ink-2); font-weight: 500; }

.ai-split { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 12px; align-items: start; margin-bottom: 14px; }
.ai-list { padding: 10px; }
.ai-filter { width: 100%; margin-bottom: 8px; }
.ai-filter button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.ai-filter .nav-badge { position: static; }
.ai-convs { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; max-height: 560px; overflow: hidden auto; }
.ai-convs > li { min-width: 0; }
.ai-conv { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 9px 8px; border-radius: 12px; color: var(--ink); text-decoration: none; }
.ai-conv:hover { background: var(--surface); }
.ai-conv.is-active { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.ai-conv.is-waiting .ai-ava { box-shadow: 0 0 0 2px var(--warn); }
.ai-conv__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ai-conv__main b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-conv__main small { font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-conv__side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: none; }
.ai-conv__side .badge { height: auto; min-height: 18px; padding: 1px 7px; font-size: 11px; font-weight: 700; }
.ai-conv__side .badge:empty { display: none; }
.ai-conv__side small { font-size: 11px; color: var(--ink-2); }
.ai-ava { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%; font-weight: 700; font-size: 14px; color: #fff;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #fff)); }
.ai-none { padding: 14px 8px; font-size: 13px; }

.ai-talk { padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.ai-talk__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.ai-talk__back { display: none; }
.ai-talk__who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ai-talk__who a { font-weight: 700; color: var(--ink); text-decoration: none; }
.ai-talk__who a[href]:hover { text-decoration: underline; }
.ai-talk__who small { font-size: 12px; color: var(--ink-2); }
.ai-talk__head .badge { height: auto; min-height: 20px; padding: 2px 8px; font-weight: 600; }
.ai-talk__reason { margin: 10px 14px 0; padding: 8px 12px; border-radius: 10px; font-size: 13px; background: var(--warn-soft); color: var(--warn); }
.ai-msgs { display: flex; flex-direction: column; gap: 8px; padding: 14px; max-height: 480px; overflow-y: auto; }
.ai-msg { max-width: 80%; padding: 9px 12px; border-radius: 16px; font-size: 14px; line-height: 1.4; }
.ai-msg p { white-space: pre-line; }
.ai-msg small { display: block; margin-top: 2px; font-size: 11px; opacity: .7; text-align: right; }
.ai-msg.is-client { align-self: flex-end; background: var(--accent); color: var(--accent-ink, #fff); border-bottom-right-radius: 5px; }
.ai-msg.is-ai { align-self: flex-start; background: color-mix(in srgb, var(--accent) 9%, var(--surface)); border-bottom-left-radius: 5px; }
.ai-visits { display: grid; gap: 6px; padding: 0 14px 14px; }
.ai-visits:empty { display: none; }
.ai-visit { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 12px; font-size: 14px; background: var(--ok-soft); color: var(--ink); }
.ai-visit .ic { color: var(--ok); flex: none; }
.ai-visit span { flex: 1; min-width: 0; }
.ai-empty { color: var(--ink-2); font-size: 14px; text-align: center; padding: 40px 16px; }

.ai-rules { display: grid; gap: 8px; }
.ai-rules .muted { font-size: 13px; }
.ai-rules__foot { display: flex; justify-content: flex-end; }

@media (max-width: 760px) {
  .ai-split { grid-template-columns: minmax(0, 1fr); }
  .ai-empty { display: none; }
  .ai-page.is-reading .ai-list, .ai-page.is-reading .ai-kpis { display: none; }
  .ai-talk__back { display: inline-grid; }
  .ai-kpis { grid-template-columns: repeat(3, 1fr); }
}

/* the dashboard's line to the talks waiting for a person */
.dash-alert--ai .dash-alert__icon { background: color-mix(in srgb, var(--warn) 16%, var(--bg)); color: var(--warn); }
