/* AI audit cards, dashboard, and the floating AI Sales Coach chat */
.ai-empty { padding: 26px 14px; text-align: center; color: var(--text-muted); font-size: 13px; }
.ai-card { display: flex; flex-direction: column; gap: 12px; }
.ai-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ai-kind { --k: #38bdf8; display: inline-block; border-radius: 999px; padding: 4px 14px; font-size: 12px; font-weight: 800; color: var(--k); background: color-mix(in srgb, var(--k) 18%, transparent); border: 1px solid color-mix(in srgb, var(--k) 50%, transparent); }
.ai-kind.sm { padding: 2px 9px; font-size: 10.5px; }
.ai-score { --s: #22c55e; display: inline-flex; align-items: baseline; gap: 2px; border-radius: 12px; padding: 4px 12px; background: color-mix(in srgb, var(--s) 16%, transparent); border: 2px solid var(--s); color: var(--s); }
.ai-score b { font-size: 22px; line-height: 1; } .ai-score small { font-size: 11px; opacity: .8; }
.ai-chip { border-radius: 999px; padding: 3px 10px; font-size: 11px; background: rgba(255,255,255,.08); color: var(--text-muted); }
.ai-chip.warn { background: rgba(245,158,11,.2); color: #fbbf24; }
.ai-sum { margin: 0; font-size: 13.5px; line-height: 1.55; }
.ai-proc { background: rgba(245,158,11,.15); border: 1px solid rgba(245,158,11,.5); border-radius: 10px; padding: 9px 12px; font-size: 12.5px; }
.ai-sec { background: rgba(255,255,255,.035); border: 1px solid var(--border-subtle); border-radius: 12px; padding: 10px 12px; }
.ai-sec h5 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.ai-sec p { margin: 0 0 6px; font-size: 13px; line-height: 1.5; } .ai-sec ul { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.5; } .ai-sec li { margin-bottom: 3px; }
.ai-sec.good { border-left: 4px solid #22c55e; } .ai-sec.miss { border-left: 4px solid #f59e0b; } .ai-sec.tips { border-left: 4px solid #38bdf8; }
.ai-warn { --w: #f59e0b; border-left: 4px solid var(--w); background: color-mix(in srgb, var(--w) 12%, transparent); border-radius: 8px; padding: 6px 10px; margin-bottom: 6px; font-size: 12.5px; }
.ai-warn b { color: var(--w); margin-right: 6px; }
.ai-ref a { color: #7dd3fc; font-weight: 600; } .ai-ref small { display: block; color: var(--text-dim); font-size: 11px; margin-bottom: 4px; }
.ai-foot { font-size: 11px; color: var(--text-dim); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.ai-sev { display: inline-block; border-radius: 6px; padding: 1px 9px; font-size: 10.5px; font-weight: 800; background: rgba(148,163,184,.18); color: #94a3b8; }
.ai-sev.high { background: rgba(239,68,68,.22); color: #fca5a5; } .ai-sev.medium { background: rgba(245,158,11,.22); color: #fbbf24; } .ai-sev.low { background: rgba(56,189,248,.18); color: #7dd3fc; } .ai-sev.ok { background: rgba(34,197,94,.18); color: #4ade80; }
.ai-diff { font-size: 11px; font-weight: 800; border-radius: 6px; padding: 1px 6px; } .ai-diff.up { background: rgba(239,68,68,.2); color: #fca5a5; } .ai-diff.down { background: rgba(245,158,11,.2); color: #fbbf24; }
.ai-subtabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 12px; border-bottom: 1px solid var(--border-subtle); padding-bottom: 8px; }
.ai-subtabs button { border: 1px solid var(--border-subtle); background: var(--bg-tertiary); color: var(--text-main); border-radius: 10px; padding: 7px 14px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.ai-subtabs button.on { background: #38bdf8; color: #06202e; border-color: transparent; }
.ai-row, .ai-crow { cursor: pointer; } .ai-row:hover td, .ai-crow:hover td { background: rgba(56,189,248,.07); }
.ai-cb { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--text-muted); }
.ai-badge { display: inline-flex; gap: 4px; align-items: center; margin-left: 6px; border-radius: 8px; padding: 1px 7px; font-size: 10.5px; font-weight: 800; vertical-align: middle; }

/* ── floating AI Sales Coach (docked on left/menu - unblocks WebRTC softphone) ──────── */
#aiFab { display: none !important; }
#aiChat {
  position: fixed;
  left: 270px;
  bottom: 20px;
  right: auto;
  z-index: 9500;
  width: min(440px, calc(100vw - 300px));
  height: min(680px, calc(100dvh - 40px));
  display: none;
  flex-direction: column;
  overflow: hidden;
  background: #0b1220;
  border: 1px solid rgba(56,189,248,.45);
  border-radius: 18px;
  box-shadow: 0 22px 60px rgba(0,0,0,.8);
}
#aiChat.open { display: flex; animation: aic-in .18s ease-out; }
@keyframes aic-in { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Sidebar AI trigger placed right above agent profile card */
.sidebar-ai-trigger {
  margin-bottom: 12px;
  padding: 9px 12px;
  background: linear-gradient(135deg, rgba(14,165,233,0.12), rgba(139,92,246,0.12));
  border: 1px solid rgba(56,189,248,0.22);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all .2s ease;
  user-select: none;
}
.sidebar-ai-trigger:hover {
  background: linear-gradient(135deg, rgba(14,165,233,0.22), rgba(139,92,246,0.24));
  border-color: rgba(56,189,248,0.5);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(14,165,233,0.18);
}
.sidebar-ai-left { display: flex; align-items: center; gap: 9px; min-width: 0; }
.sidebar-ai-icon { font-size: 20px; line-height: 1; filter: drop-shadow(0 2px 6px rgba(14,165,233,0.4)); }
.sidebar-ai-meta { display: flex; flex-direction: column; min-width: 0; }
.sidebar-ai-name { font-size: 12.5px; font-weight: 700; color: #38bdf8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-ai-desc { font-size: 10.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-ai-badge { font-size: 10px; font-weight: 800; text-transform: uppercase; background: rgba(56,189,248,0.18); color: #38bdf8; border: 1px solid rgba(56,189,248,0.32); border-radius: 6px; padding: 2px 7px; }

/* AI Settings layout */
.ai-settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: 16px; margin-bottom: 20px; }
.ai-switch-banner { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-radius: 14px; background: rgba(255,255,255,0.02); border: 1px solid var(--border-subtle); margin-bottom: 16px; flex-wrap: wrap; gap: 14px; }
.ai-status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.ai-status-pill.active { background: rgba(34,197,94,0.16); color: #4ade80; border: 1px solid rgba(34,197,94,0.35); }
.ai-status-pill.inactive { background: rgba(239,68,68,0.16); color: #f87171; border: 1px solid rgba(239,68,68,0.35); }
.ai-status-pill.warning { background: rgba(245,158,11,0.16); color: #fbbf24; border: 1px solid rgba(245,158,11,0.35); }
.ai-callout-box { background: rgba(14,165,233,0.06); border-left: 4px solid #0ea5e9; border-radius: 8px; padding: 12px 14px; font-size: 12.5px; line-height: 1.55; color: #bae6fd; margin-bottom: 14px; }
.ai-callout-box strong { color: #fff; }
.ai-form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.ai-form-group label { font-size: 12px; font-weight: 600; color: var(--text-muted); display: flex; justify-content: space-between; align-items: center; }
.ai-form-group input, .ai-form-group select, .ai-form-group textarea { background: #111827; border: 1px solid var(--border-subtle); color: #fff; border-radius: 10px; padding: 10px 12px; font-family: inherit; font-size: 13px; }
.ai-form-group input:focus, .ai-form-group select:focus, .ai-form-group textarea:focus { border-color: #38bdf8; outline: none; box-shadow: 0 0 0 2px rgba(56,189,248,0.2); }
.ai-stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.ai-stat-card { background: rgba(255,255,255,0.03); border: 1px solid var(--border-subtle); border-radius: 12px; padding: 12px 14px; }
.ai-stat-card .val { font-size: 22px; font-weight: 800; color: #38bdf8; line-height: 1.2; }
.ai-stat-card .lbl { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; }
.aic-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: linear-gradient(135deg, rgba(14,165,233,.25), rgba(139,92,246,.25)); border-bottom: 1px solid var(--border-subtle); }
.aic-head > div { flex: 1; min-width: 0; } .aic-head b { display: block; font-size: 14px; } .aic-head small { color: var(--text-muted); font-size: 10.5px; }
.aic-head select { max-width: 130px; padding: 5px 6px; font-size: 12px; border-radius: 8px; background: #111827; color: #fff; border: 1px solid var(--border-subtle); }
.aic-head button { background: transparent; border: 0; color: var(--text-muted); font-size: 16px; cursor: pointer; padding: 4px 6px; border-radius: 6px; } .aic-head button:hover { background: rgba(255,255,255,.1); color: #fff; }
.aic-msgs { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.aic-hello { background: rgba(255,255,255,.05); border-radius: 14px; padding: 12px 14px; font-size: 13px; line-height: 1.5; } .aic-hello p { margin: 6px 0 0; color: var(--text-muted); }
.aic-u { align-self: flex-end; max-width: 86%; } .aic-u > div { background: #0ea5e9; color: #04202e; font-weight: 600; border-radius: 14px 14px 4px 14px; padding: 8px 12px; font-size: 13.5px; white-space: pre-wrap; word-break: break-word; }
.aic-a { align-self: flex-start; max-width: 96%; } .aic-body { background: #172033; border-radius: 14px 14px 14px 4px; padding: 10px 13px; font-size: 13.5px; line-height: 1.55; word-break: break-word; }
.aic-body p { margin: 0 0 4px; } .aic-body ul { margin: 2px 0 6px; padding-left: 18px; } .aic-body li { margin-bottom: 3px; } .aic-body .sp { height: 6px; } .aic-body b { color: #7dd3fc; } .aic-body code { background: rgba(255,255,255,.1); border-radius: 4px; padding: 0 4px; } .aic-body a { color: #7dd3fc; }
.aic-src { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; } .aic-src a { font-size: 11px; background: rgba(56,189,248,.14); color: #7dd3fc; border-radius: 999px; padding: 3px 10px; text-decoration: none; }
.aic-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 8px; } .aic-chips button { background: rgba(255,255,255,.06); color: var(--text-main); border: 1px solid var(--border-subtle); border-radius: 999px; padding: 5px 11px; font-size: 11.5px; cursor: pointer; text-align: left; } .aic-chips button:hover { border-color: #38bdf8; }
.aic-in { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border-subtle); background: #0e1626; }
.aic-in textarea { flex: 1; resize: none; background: #172033; color: #fff; border: 1px solid var(--border-subtle); border-radius: 12px; padding: 9px 12px; font: inherit; font-size: 13.5px; max-height: 120px; }
.aic-in button { width: 44px; border: 0; border-radius: 12px; background: linear-gradient(135deg, #0ea5e9, #8b5cf6); color: #fff; font-size: 18px; cursor: pointer; }
.aic-dots i { display: inline-block; width: 7px; height: 7px; margin-right: 4px; border-radius: 50%; background: #7dd3fc; animation: aic-b 1s infinite ease-in-out; } .aic-dots i:nth-child(2) { animation-delay: .15s; } .aic-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes aic-b { 0%, 80%, 100% { transform: scale(.5); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }
@media (max-width: 760px) { #aiFab { display: none !important; } #aiChat { left: 0; right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; z-index: 9999; } }
