/* Bot Runtime —— 与 Agent 配置页共用同一套排版语汇：
   同一组工具栏 / 卡片式下拉 / 手风琴 / sticky footer，只补 Bot 专属的行内细节。 */

/* ===== 头部：网关状态 + 刷新（Agent 页头部放导入导出，这里换成状态与刷新） ===== */
#botsPage .bot-health {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-tertiary);
    white-space: nowrap;
}
#botsPage .bot-health i {
    font-size: 7px;
    color: var(--text-tertiary);
}
#botsPage .bot-health.ok i { color: var(--accent); }
#botsPage .bot-health.off i { color: var(--danger); }
#botsPage .bot-refresh {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    color: var(--accent);
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}
#botsPage .bot-refresh:active {
    background: var(--accent);
    color: var(--on-accent);
}

/* ===== 空状态：与列表空态同一种克制写法（不抢主按钮的焦点） ===== */
#botsPage .bot-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 56px 20px;
    text-align: center;
    color: var(--text-tertiary);
}
#botsPage .bot-empty > i {
    font-size: 26px;
    opacity: 0.45;
    margin-bottom: 2px;
}
#botsPage .bot-empty p {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
}
#botsPage .bot-empty span {
    font-size: 13px;
    line-height: 1.6;
}

/* ===== 手风琴标题里的数量徽标 ===== */
#botsPage .bot-badge {
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 8px;
    background: var(--accent-light);
    color: var(--accent);
    font-size: 11px;
    font-weight: 600;
    vertical-align: 1px;
}

/* ===== 常设职责列表 ===== */
#botsPage .bot-routine-list {
    display: flex;
    flex-direction: column;
}
#botsPage .bot-routine-row {
    padding: 12px 0;
    border-bottom: 0.5px solid var(--border);
}
#botsPage .bot-routine-row:first-child {
    padding-top: 2px;
}
#botsPage .bot-routine-row:last-child {
    border-bottom: none;
}
#botsPage .bot-routine-head {
    display: flex;
    align-items: center;
    gap: 10px;
}
#botsPage .bot-routine-event {
    flex: 1;
    min-width: 0;
    font-size: 11px;
    letter-spacing: 0.02em;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#botsPage .bot-routine-actions {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}
#botsPage .bot-routine-actions button {
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    cursor: pointer;
}
#botsPage .bot-routine-actions button.danger {
    color: var(--danger);
}
#botsPage .bot-routine-prompt {
    margin: 6px 0 0;
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-secondary);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
#botsPage .bot-empty-row {
    padding: 12px 0 4px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-tertiary);
}
#botsPage .bot-add-routine {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 10px 0 16px;
}

/* ===== 接入与运行 ===== */
#botsPage .bot-hook-row {
    display: flex;
    gap: 8px;
}
#botsPage .bot-hook-row input {
    flex: 1;
    min-width: 0;
    font-family: var(--font-mono, monospace);
    font-size: 12px;
}
#botsPage .bot-hint,
#botTestModal .bot-hint {
    margin: 8px 0 0;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-tertiary);
}
#botsPage .bot-hint code {
    padding: 1px 3px;
    border-radius: 3px;
    background: var(--bg-secondary);
    font-family: var(--font-mono, monospace);
    font-size: 11px;
}
#botsPage .bot-gateway-line {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-secondary);
}
#botsPage .bot-inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
#botsPage .btn-small.danger {
    color: var(--danger);
}

/* ===== 禁用态：没有选中 Bot 时，保存/归档不可点 ===== */
#botsPage .btn-primary[disabled],
#botsPage .btn-icon-del[disabled] {
    opacity: 0.4;
    pointer-events: none;
}

/* ===== 键盘焦点：只在键盘导航时出现，不影响触屏 ===== */
#botsPage .agent-select-trigger:focus-visible,
#botsPage .agent-select-card:focus-visible,
#botsPage .bot-refresh:focus-visible,
#botsPage .btn-icon-add:focus-visible,
#botsPage .btn-icon-del:focus-visible,
#botsPage .bot-routine-actions button:focus-visible,
#createBotModal .bot-ai-btn:focus-visible,
#createBotModal .bot-ai-routine-remove:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ===== 新建 Bot：一句话 AI 生成配置 ===== */
#createBotModal .bot-ai-field label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--accent);
    font-weight: 600;
}
#createBotModal .bot-ai-btn {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--accent-light);
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}
#createBotModal .bot-ai-btn:active {
    background: var(--accent);
    color: var(--on-accent);
}
#createBotModal .bot-ai-btn[disabled] {
    opacity: 0.6;
    pointer-events: none;
}
#createBotModal .bot-ai-state {
    margin: 0;
    font-size: 12px;
    line-height: 1.55;
    color: var(--text-tertiary);
    overflow-wrap: anywhere;
}
#createBotModal .bot-ai-state.warn { color: var(--text-secondary); }
#createBotModal .bot-ai-state.ok { color: var(--accent); }
#createBotModal .bot-ai-state.error { color: var(--danger); }

#createBotModal .bot-ai-routine-list {
    display: flex;
    flex-direction: column;
}
#createBotModal .bot-ai-routine {
    padding: 10px 0;
    border-bottom: 0.5px solid var(--border);
}
#createBotModal .bot-ai-routine:first-child { padding-top: 2px; }
#createBotModal .bot-ai-routine:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
#createBotModal .bot-ai-routine-head {
    display: flex;
    align-items: center;
    gap: 10px;
}
#createBotModal .bot-ai-routine-key {
    flex: 1;
    min-width: 0;
    font-size: 11px;
    letter-spacing: 0.02em;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#createBotModal .bot-ai-routine-remove {
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--danger);
    cursor: pointer;
    flex-shrink: 0;
}
#createBotModal .bot-ai-routine-prompt {
    margin: 6px 0 0;
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-secondary);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
