/* APIs and integrations (module 35-integrations). Prefix ai-. */
.ai-ref { font-family: Consolas, 'Courier New', monospace; font-size: 12px; white-space: nowrap; }
.ai-wrap { white-space: normal; word-break: break-all; display: block; margin-top: 6px; }
.ai-mini { font-size: 12px; color: var(--muted); margin: 4px 0; }
.ai-mini.bad, .ct-tbl .sub.bad, span.bad { color: var(--badFg); }
.ai-code { font-family: Consolas, 'Courier New', monospace; font-size: 12px; background: #0f2236; color: #d6e6f7; border-radius: 4px; padding: 10px 12px; white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; max-height: 360px; overflow: auto; position: relative; margin: 6px 0; }
.ai-code b { color: #fff; }
.ai-list { margin: 4px 0 6px; padding-left: 18px; font-size: 12.5px; }
.ai-list li { margin: 3px 0; }
.ai-steps { margin: 0; padding-left: 20px; font-size: 12.5px; display: grid; gap: 6px; }
.ai-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ai-two > * { min-width: 0; }
.ai-bulk { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid #e0e7ed; background: #fbfdff; }
.ai-bulk .ct-input { max-width: 280px; min-width: 0; }
.ai-saved { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* scopes and methods */
.ai-scopes { white-space: normal; min-width: 180px; }
.ai-scope { display: inline-block; font: 600 11px Consolas, 'Courier New', monospace; padding: 1px 6px; margin: 1px 3px 1px 0; border-radius: 9px; background: #e8f1fb; color: #1d5a96; border: 1px solid #c9dcf0; white-space: nowrap; }
.ai-scope.w { background: #fff3df; color: #8a5300; border-color: #f0d5a5; }
.ai-method { display: inline-block; min-width: 46px; text-align: center; font: 700 10.5px Consolas, 'Courier New', monospace; padding: 2px 5px; border-radius: 3px; color: #fff; background: #5b6b7f; }
.ai-method.get { background: #1a7fe0; } .ai-method.post { background: #12a079; } .ai-method.patch, .ai-method.put { background: #d99a06; } .ai-method.delete { background: #d6334b; }
.ai-scopepick { display: grid; gap: 6px; }
.ai-scopepick .ct-check { align-items: flex-start; }
.ai-scopepick small { display: block; }
.ai-events { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; }
.ai-events .ct-check { align-items: flex-start; min-width: 0; }

/* token shown once */
.ai-once { align-items: flex-start; }
.ai-token { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.ai-token code { font: 700 13px Consolas, 'Courier New', monospace; background: #fff; border: 1px dashed #c8a24a; padding: 4px 8px; border-radius: 3px; word-break: break-all; }

/* catalogue */
.ai-cat { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.ai-card { background: #fff; border: 1px solid #cbd7e2; border-top: 3px solid #8a9bb0; border-radius: 4px; padding: 11px 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; box-shadow: var(--shadow); }
.ai-card.live { border-top-color: #12a079; } .ai-card.sandbox { border-top-color: #1a7fe0; } .ai-card.error { border-top-color: #d6334b; } .ai-card.off { border-top-color: #b8c4d0; }
.ai-card .top { display: flex; gap: 10px; align-items: flex-start; }
.ai-card .top > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; align-items: flex-start; }
.ai-card .ic { width: 34px; height: 34px; border-radius: 6px; display: grid; place-items: center; flex: none; font-size: 17px; background: var(--infoBg); color: var(--infoFg); }
.ai-card.live .ic { background: var(--okBg); color: var(--okFg); } .ai-card.error .ic { background: var(--badBg); color: var(--badFg); }
.ai-card b { font-size: 13px; color: #1d3650; }
.ai-card p { margin: 0; font-size: 12px; color: #4a6077; flex: 1; }
.ai-card .foot { display: flex; gap: 8px; align-items: center; justify-content: space-between; border-top: 1px solid #e6edf3; padding-top: 8px; }
.ai-card .foot small { color: var(--muted); font-size: 11.5px; min-width: 0; }

/* panels: gauge, feed, hook list, health */
.ai-gauge { display: flex; justify-content: center; padding: 4px 0; }
.ai-feed { display: flex; flex-direction: column; }
.ai-fi { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid #e6edf3; font-size: 12.5px; }
.ai-fi:last-child { border-bottom: 0; }
.ai-fi > i { width: 28px; height: 28px; border-radius: 4px; display: grid; place-items: center; flex: none; background: var(--infoBg); color: var(--infoFg); }
.ai-fi > div { min-width: 0; display: flex; flex-direction: column; }
.ai-fi b { text-transform: none; }
.ai-fi small, .ai-fi span { color: var(--muted); font-size: 11.5px; overflow-wrap: anywhere; }
.ai-hooklist { display: flex; flex-direction: column; }
.ai-hooklist .row { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid #e6edf3; font-size: 12.5px; }
.ai-hooklist .row:last-child { border-bottom: 0; }
.ai-health td { white-space: normal; }
.ai-health td:first-child i { color: #4a6077; margin-right: 4px; }

/* API documentation */
.ai-toc-col { position: sticky; top: 10px; }
.ai-toc { display: flex; flex-direction: column; max-height: 78vh; overflow: auto; font-size: 12.5px; }
.ai-toc a { padding: 4px 2px; border-bottom: 1px solid #eef2f6; color: #22517a; display: flex; gap: 6px; align-items: center; }
.ai-toc a.sub { padding-left: 8px; font-size: 12px; }
.ai-toc a .mut { margin-left: auto; }
.ai-toc .ai-method { min-width: 40px; font-size: 9.5px; }
.ai-ep { scroll-margin-top: 12px; }
.ai-ephead { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; margin-bottom: 4px; }
.ai-ephead code { white-space: normal; word-break: break-all; }
.ai-params { margin: 8px 0; }
.ai-ex { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ai-ex > div { min-width: 0; }
.ai-prose p { margin: 0 0 8px; font-size: 13px; }
.ai-prose code, .ai-docs p code { white-space: normal; }

/* customer context, issues, phone */
.ai-ctx { border: 1px solid #dbe4ec; border-left: 3px solid #1a7fe0; border-radius: 4px; padding: 8px 10px; margin-bottom: 8px; background: #fbfdff; }
.ai-ctx.sandbox { border-left-color: #2bb3d9; } .ai-ctx.error { border-left-color: #d6334b; background: #fff8f9; } .ai-ctx.none { border-left-color: #b8c4d0; }
.ai-ctx-h { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12.5px; margin-bottom: 4px; }
.ai-dl { margin: 4px 0; }
.ai-refresh { display: flex; justify-content: flex-end; }
.ai-issue { border-bottom: 1px solid #e6edf3; padding: 6px 0; }
.ai-issue:last-child { border-bottom: 0; }
.ai-phone { display: flex; flex-direction: column; gap: 8px; }
.ai-calllog textarea { min-height: 60px; }
.ai-flow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border: 1px solid #cbd7e2; border-radius: 4px; overflow: hidden; background: #fff; }
.ai-flow .st { padding: 10px 12px; font-weight: 700; font-size: 12.5px; color: #7c8da0; border-right: 1px solid #e0e7ed; display: flex; gap: 6px; align-items: center; }
.ai-flow .st:last-child { border-right: 0; }
.ai-flow .st.done { color: var(--okFg); background: var(--okBg); }
.ai-flow .st.on { color: #fff; background: var(--brand-primary); }

@media (max-width: 1280px) { .ai-cat { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1180px) { .ai-toc-col { position: static; } .ai-toc { max-height: 240px; } }
@media (max-width: 900px) { .ai-ex, .ai-events { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
    .ai-cat, .ai-two { grid-template-columns: 1fr; }
    .ai-flow { grid-template-columns: 1fr; }
    .ai-flow .st { border-right: 0; border-bottom: 1px solid #e0e7ed; }
    .ai-bulk .ct-input { max-width: none; width: 100%; }
}
.ai-wrapcells td, .ai-wrapcells td .sub { white-space: normal; }
.ct-tbl td.ai-scopes { white-space: normal; min-width: 170px; }
.ai-conn { display: flex; flex-direction: column; }
.ai-conn .row { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid #e6edf3; font-size: 12.5px; min-width: 0; }
.ai-conn .row:last-child { border-bottom: 0; }
.ai-conn .row i { color: #4a6077; width: 16px; flex: none; }
.ai-conn .row a, .ai-conn .row span:not(.ct-pill) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* A table cell whose description wraps instead of pushing the table wider than its panel. */
.ct-tbl td.ai-cellwrap { white-space: normal; min-width: 180px; }
