## Block styles

`PATCH /v1/pages/:pageId/blocks/:blockId/styles`

Replaces classList while preserving every manifest selector class automatically, including those needed by later edits in the same request. style is a property map. Unknown selectors and indices are 400. Returns content read back.

Overlapping `.class` and `.class@N` entries run in request order. When indexed expansions collide, the wrapper makes sequential Bitrix24 calls; a later failure does not roll back earlier changes.

Requires `landing` scope; READONLY keys receive 403 before Bitrix24 is called.

## Parameters

`pageId` and `blockId`: positive safe integers; the block must belong to the page. Optional query `scope=KNOWLEDGE|GROUP|MAINPAGE` selects the page context.

Selectors: `.class` or `.class@N`, with a zero-based index. The map must not be empty. Read available selectors from the block manifest; unknown-selector errors list available selectors.

## Example

```bash
curl -X PATCH "https://vibecode.bitrix24.com/v1/pages/42/blocks/7/styles" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"styles":{".landing-block-node-title":{"classList":["g-color-red"]}}}'
```

## Response

```json
{
  "success": true,
  "data": {
    "id": 7,
    "pageId": 42,
    "anchor": "chapter",
    "content": "<h2 class=\"landing-block-node-title\">Title</h2>",
    "nodes": {},
    "styles": {},
    "attrs": {},
    "cards": {},
    "active": true
  }
}
```

HTML is a data string: sanitize it before rendering. nodes/styles/attrs/cards absent in the Bitrix24 response become empty objects; stored values are visible in content.

## Errors

400 `INVALID_PARAMS` / `MISSING_REQUIRED_FIELDS` / `INVALID_SCOPE`; 403 `SCOPE_DENIED` / `WRITE_BLOCKED_READONLY_KEY`; 404 `ENTITY_NOT_FOUND`; 409 `LANDING_MODULE_NOT_ENABLED` / `PORTAL_ADDRESS_CHANGED`; 422 `BITRIX_ERROR`; 429, 502, 503.
