/* Bots: the conversations desk reads as a chat; the schema is drawn as cards and arrows. */
.bots-vars { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px 14px; margin: 10px 0 0; font-size: 13px; }
.bots-vars dt { color: var(--atlas-muted); font-size: 11.5px; } .bots-vars dd { margin: 0; overflow-wrap: anywhere; }

/* The desk: list, thread, contact card */
.bots-desk { display: grid; grid-template-columns: 320px minmax(0, 1fr) 300px; gap: var(--atlas-gap); height: calc(100vh - 210px); min-height: 520px; font-family: var(--atlas-font); color: var(--atlas-text); }
.bots-desk.no-card { grid-template-columns: 320px minmax(0, 1fr); }
.bots-desk-panel { background: var(--atlas-card); border: 1px solid var(--atlas-line); border-radius: var(--atlas-radius); box-shadow: var(--atlas-shadow); min-height: 0; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

.bots-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 12px 0; }
.bots-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--atlas-line); border-radius: 999px; background: var(--atlas-card); color: var(--atlas-muted); font-size: 12.5px; line-height: 1.4; cursor: pointer; }
.bots-chip:hover { background: var(--atlas-soft); color: var(--atlas-text); }
.bots-chip.active { background: var(--atlas-accent-soft); border-color: var(--atlas-accent); color: var(--atlas-accent); font-weight: 600; }
.bots-chip .n { font-variant-numeric: tabular-nums; font-size: 11.5px; color: inherit; opacity: .8; }

.bots-rows { flex: 1; min-height: 0; overflow: auto; padding: 10px 0 0; margin-top: 10px; border-top: 1px solid var(--atlas-line); }
.bots-row { display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 10px 14px 10px 12px; border: 0; border-left: 3px solid transparent; border-bottom: 1px solid var(--atlas-line); background: none; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.bots-row:hover { background: var(--atlas-soft); }
.bots-row.active { background: var(--atlas-accent-soft); border-left-color: var(--atlas-accent); }
.bots-row .top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.bots-row .name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bots-row .time { margin-left: auto; color: var(--atlas-faint); font-size: 11.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bots-row .snippet { color: var(--atlas-muted); font-size: 12.5px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bots-row .badges { display: flex; flex-wrap: wrap; gap: 4px; }
.bots-row .badges .atlas-badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bots-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--atlas-info); }
.bots-more { margin: 10px 12px 12px; padding: 6px 10px; border: 1px dashed var(--atlas-line); border-radius: var(--atlas-radius-sm); background: none; color: var(--atlas-muted); font: inherit; font-size: 12.5px; cursor: pointer; }
.bots-more:hover { color: var(--atlas-text); background: var(--atlas-soft); }

.bots-desk-thread > .atlas-empty { margin: auto; }
.bots-thread-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--atlas-line); }
.bots-thread-head .name { font-weight: 600; font-size: 15px; }
.bots-thread-head .sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 2px; color: var(--atlas-muted); font-size: 12.5px; }
.bots-thread-head .actions { display: flex; flex-wrap: wrap; gap: 6px; }
.bots-thread-log { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; }
.bots-thread-log .msg { max-width: 78%; padding: 7px 11px; border-radius: 12px; font-size: 13.5px; line-height: 1.45; display: flex; flex-direction: column; gap: 3px; overflow-wrap: anywhere; }
.bots-thread-log .msg .text { white-space: pre-line; }
.bots-thread-log .msg.in { align-self: flex-start; background: var(--atlas-soft); border-bottom-left-radius: 4px; }
.bots-thread-log .msg.out { align-self: flex-end; background: var(--atlas-accent-soft); border-bottom-right-radius: 4px; }
.bots-thread-log .msg.refused, .bots-thread-log .msg.failed { border: 1px dashed var(--atlas-bad); }
.bots-thread-log .msg small { font-size: 11px; color: var(--atlas-muted); }
.bots-thread-log .msg.refused small, .bots-thread-log .msg.failed small { color: var(--atlas-bad); }
.bots-thread-log .msg .choices { display: flex; flex-wrap: wrap; gap: 4px; }
.bots-thread-log .msg .choices span { padding: 1px 8px; border: 1px solid var(--atlas-line); border-radius: 999px; background: var(--atlas-card); font-size: 12px; }
.bots-sys { align-self: center; max-width: 90%; text-align: center; }
.bots-sys span { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--atlas-soft); color: var(--atlas-muted); font-size: 11.5px; line-height: 1.4; }

.bots-reply { border-top: 1px solid var(--atlas-line); padding: 10px 12px 12px; }
.bots-reply textarea { display: block; width: 100%; resize: vertical; min-height: 64px; padding: 8px 10px; border: 1px solid var(--atlas-line); border-radius: var(--atlas-radius-sm); background: var(--atlas-card); color: var(--atlas-text); font: 13.5px/1.5 var(--atlas-font); }
.bots-reply textarea:focus { outline: 2px solid var(--atlas-accent-soft); border-color: var(--atlas-accent); }
.bots-reply .foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.bots-reply .hint { color: var(--atlas-faint); font-size: 11.5px; }
.bots-reply-blocked { border-top: 1px solid var(--atlas-line); padding: 12px 16px; color: var(--atlas-muted); font-size: 13px; background: var(--atlas-soft); }

.bots-desk-card { overflow: auto; padding: 14px 16px; gap: 6px; }
.bots-card-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.bots-card-label { margin-top: 12px; color: var(--atlas-muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.bots-card-muted { color: var(--atlas-faint); font-size: 13px; }
.bots-desk-card .bots-vars { grid-template-columns: 1fr; margin-top: 4px; }
.bots-facts { display: grid; gap: 6px; margin: 12px 0 0; font-size: 13px; }
.bots-facts div { display: flex; justify-content: space-between; gap: 10px; }
.bots-facts dt { color: var(--atlas-muted); } .bots-facts dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.bots-history { margin-top: 6px; gap: 10px; }
.bots-desk-card .atlas-timeline.bots-history li { grid-template-columns: 1fr; gap: 2px; font-size: 13px; }

/* The schema: toolbar, canvas, side panel */
.bots-schema { display: flex; flex-direction: column; gap: var(--atlas-gap); font-family: var(--atlas-font); color: var(--atlas-text); }
.bots-schema-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.bots-schema-bar-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bots-schema-langs { display: inline-flex; gap: 4px; }
.bots-schema-muted { color: var(--atlas-muted); font-size: 12.5px; line-height: 1.45; }
.bots-schema-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--atlas-gap); align-items: start; }

.bots-canvas { background: var(--atlas-card); border: 1px solid var(--atlas-line); border-radius: var(--atlas-radius); box-shadow: var(--atlas-shadow); min-width: 0; overflow: hidden; display: flex; flex-direction: column; }
.bots-canvas-tools { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--atlas-line); }
.bots-canvas-zoom { display: flex; align-items: center; gap: 4px; }
.bots-canvas-zoom .bots-chip { min-width: 30px; justify-content: center; }
.bots-canvas-pct { min-width: 44px; text-align: center; color: var(--atlas-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.bots-legend { display: flex; flex-wrap: wrap; gap: 12px; color: var(--atlas-muted); font-size: 11.5px; }
.bots-legend span { display: inline-flex; align-items: center; gap: 6px; }
.bots-legend .line { display: inline-block; width: 22px; border-top: 1.5px solid var(--atlas-faint); }
.bots-legend .line.back { border-top-style: dashed; }
.bots-legend .port { display: inline-block; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--atlas-faint); }
.bots-canvas-scroll { position: relative; overflow: auto; height: calc(100vh - 280px); min-height: 440px; background-color: var(--atlas-soft); background-image: radial-gradient(var(--atlas-line) 1px, transparent 1px); background-size: 16px 16px; }
.bots-canvas-scroll > .atlas-empty { margin: 60px auto; max-width: 420px; }
.bots-canvas-sizer { position: relative; }
.bots-canvas-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }

.bots-edges { position: absolute; left: 0; top: 0; overflow: visible; color: var(--atlas-faint); pointer-events: none; }
.bots-edge { fill: none; stroke: currentColor; stroke-width: 1.5; }
.bots-edge.back { stroke-dasharray: 5 4; }
.bots-edge.hot { stroke: var(--atlas-accent); stroke-width: 2; }
.bots-edge-label { position: absolute; transform: translate(-50%, -50%); padding: 0 6px; border-radius: 999px; background: var(--atlas-soft); color: var(--atlas-muted); font-size: 11px; line-height: 16px; white-space: nowrap; font-family: var(--atlas-mono); }

.bots-node { position: absolute; box-sizing: border-box; display: flex; flex-direction: column; padding: 0; overflow: visible; text-align: left; cursor: pointer; font: inherit; color: var(--atlas-text); background: var(--atlas-card); border: 1px solid var(--atlas-line); border-left: 4px solid var(--atlas-faint); border-radius: var(--atlas-radius-sm); box-shadow: var(--atlas-shadow); }
.bots-node:hover { border-color: var(--atlas-accent); }
.bots-node:focus-visible { outline: 2px solid var(--atlas-accent); outline-offset: 2px; }
.bots-node.active { border-color: var(--atlas-accent); box-shadow: 0 0 0 3px var(--atlas-accent-soft), var(--atlas-shadow); }
.bots-node.k-language, .bots-node.k-consent { border-left-color: var(--atlas-info); }
.bots-node.k-say { border-left-color: var(--atlas-faint); }
.bots-node.k-ask, .bots-node.k-choices { border-left-color: var(--atlas-accent); }
.bots-node.k-handover { border-left-color: var(--atlas-warn); }
.bots-node.k-end { border-left-color: var(--atlas-muted); }
.bots-node.has-errors { border-color: var(--atlas-bad); border-left-color: var(--atlas-bad); }
.bots-node.unreached { opacity: .7; border-style: dashed; }
.bots-node-head { position: relative; display: block; flex: none; height: 44px; box-sizing: border-box; padding: 6px 30px 0 10px; }
.bots-node-kind { display: flex; align-items: center; gap: 6px; color: var(--atlas-muted); font-size: 10.5px; line-height: 14px; text-transform: uppercase; letter-spacing: .04em; }
.bots-node-entry { padding: 0 5px; border-radius: 4px; background: var(--atlas-info); color: var(--atlas-card); font-size: 9.5px; line-height: 13px; letter-spacing: .03em; }
.bots-node-name { display: block; font-family: var(--atlas-mono); font-size: 12.5px; font-weight: 600; line-height: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bots-node-errs { position: absolute; right: 8px; top: 8px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--atlas-bad); color: var(--atlas-card); font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; }
.bots-node-text { display: block; flex: none; height: 62px; box-sizing: border-box; padding: 5px 10px 0; border-top: 1px solid var(--atlas-line); color: var(--atlas-text); font-size: 12px; line-height: 17px; }
.bots-node-clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; max-height: 51px; overflow: hidden; white-space: pre-line; overflow-wrap: anywhere; }
.bots-node-text.missing { color: var(--atlas-faint); font-style: italic; }
.bots-port { position: relative; display: flex; align-items: center; gap: 6px; flex: none; height: 26px; box-sizing: border-box; padding: 0 14px 0 10px; border-top: 1px solid var(--atlas-line); font-size: 11.5px; line-height: 1; }
.bots-port-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bots-port.declined .bots-port-label { color: var(--atlas-muted); }
.bots-port-to { max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--atlas-faint); font-family: var(--atlas-mono); font-size: 10.5px; }
.bots-port-dot { position: absolute; right: -5px; top: 50%; width: 9px; height: 9px; margin-top: -4.5px; border-radius: 50%; background: var(--atlas-faint); border: 1.5px solid var(--atlas-card); box-sizing: border-box; }
.bots-port.open .bots-port-dot { background: var(--atlas-card); border-color: var(--atlas-faint); }
.bots-port.open .bots-port-label { color: var(--atlas-muted); }
.bots-node.active .bots-port-dot { background: var(--atlas-accent); }

.bots-schema-side { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 32px); overflow: auto; padding: 14px 16px; background: var(--atlas-card); border: 1px solid var(--atlas-line); border-radius: var(--atlas-radius); box-shadow: var(--atlas-shadow); }
.bots-side-head .bots-card-title { font-family: var(--atlas-mono); margin: 2px 0; overflow-wrap: anywhere; }
.bots-side-head .bots-card-label { margin-top: 0; }
.bots-side-errors { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; border-radius: var(--atlas-radius-sm); background: var(--atlas-soft); font-size: 12.5px; line-height: 1.45; }
.bots-side-errors .bad { color: var(--atlas-bad); }
.bots-side-form { display: flex; flex-direction: column; gap: 12px; }
.bots-side-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.bots-side-empty { padding: 24px 0; }
.bots-side-read { display: grid; gap: 12px; margin: 0; font-size: 13px; }
.bots-side-read dt { color: var(--atlas-muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.bots-side-read dd { margin: 0 0 4px; white-space: pre-line; overflow-wrap: anywhere; line-height: 1.45; }
.bots-side-read .lang { display: inline-block; min-width: 26px; margin-right: 6px; color: var(--atlas-faint); font-size: 11px; font-family: var(--atlas-mono); }

.bots-try { display: flex; flex-direction: column; gap: 10px; }
.bots-try-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.bots-try-log { max-height: 460px; min-height: 160px; padding: 10px; border: 1px solid var(--atlas-line); border-radius: var(--atlas-radius-sm); background: var(--atlas-card); }
.bots-try-log .msg { max-width: 90%; }
.bots-try-choice { padding: 1px 8px; border: 1px solid var(--atlas-line); border-radius: 999px; background: var(--atlas-card); color: var(--atlas-accent); font: inherit; font-size: 12px; cursor: pointer; }
.bots-try-choice:hover { background: var(--atlas-accent-soft); }
.bots-try .bots-reply { padding: 0; border-top: 0; }

@media (max-width: 1100px) {
  .bots-desk, .bots-desk.no-card { grid-template-columns: minmax(0, 1fr); height: auto; }
  .bots-desk-list .bots-rows { max-height: 360px; }
  .bots-thread-log { max-height: 520px; }
  .bots-schema-grid { grid-template-columns: minmax(0, 1fr); }
  .bots-schema-side { position: static; max-height: none; }
  .bots-canvas-scroll { height: 70vh; }
}

/* The bot's header: name and channel small, tabs beside them, top left. */
.bots-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; }
.bots-head-title { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.bots-head-title h1 { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.3; color: var(--atlas-text); }
.bots-head-title span { color: var(--atlas-muted); font-size: 12.5px; line-height: 1.3; }
.bots-head-tabs.fi-tabs { margin: 0; }

/* Full screen for the desk and the schema: the work takes the window; Esc, the button or Back return. */
html.bots-noscroll { overflow: hidden; }
.bots-full-bar { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-bottom: 10px; }
.bots-full-name { display: none; font-weight: 600; font-size: 14px; color: var(--atlas-text); margin-right: auto; }
.bots-full-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--atlas-line); border-radius: var(--atlas-radius-sm); background: var(--atlas-card); color: var(--atlas-muted); font: inherit; font-size: 12.5px; line-height: 1.4; cursor: pointer; }
.bots-full-toggle:hover { color: var(--atlas-text); background: var(--atlas-soft); }
.bots-full-toggle:focus-visible { outline: 2px solid var(--atlas-accent); outline-offset: 1px; }
.bots-full-icon { width: 16px; height: 16px; }
.bots-full.is-full { position: fixed; inset: 0; z-index: 35; overflow: auto; padding: 14px 16px; background: var(--atlas-bg); }
.bots-full.is-full .bots-full-name { display: inline; }
.bots-full-desk.is-full .bots-desk { height: calc(100vh - 74px); }
.bots-schema.is-full .bots-canvas-scroll { height: calc(100vh - 150px); }
.bots-schema.is-full .bots-schema-side { max-height: calc(100vh - 90px); }
@media (max-width: 1100px) { .bots-full-desk.is-full .bots-desk { height: auto; } }
.bots-schema.is-full .bots-schema-bar > .bots-full-name { order: -1; margin-right: 8px; }

/* Panning: right or middle button held, the hand closes and the schema follows the mouse. */
.bots-canvas-scroll.is-panning, .bots-canvas-scroll.is-panning * { cursor: grabbing !important; user-select: none; }
.bots-legend-pan { color: var(--atlas-faint); }
