/* ── AeroVision — Styles ────────────────────────────────────────── */
:root {
    --bg: #0e1015;
    --surface: #181b22;
    --surface-hover: #20242e;
    --border: #282d3a;
    --text: #cdd0da;
    --text-muted: #6b7080;
    --primary: #5b8def;
    --primary-hover: #7ba4f7;
    --success: #4caf87;
    --warning: #d4a04a;
    --error: #d45565;
    --radius: 5px;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.45;
    font-size: 0.78rem;
    -webkit-font-smoothing: antialiased;
}

/* ── Navbar ──────────────────────────────────────────────────── */
.navbar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0 1.5rem;
    height: 40px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.logo {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    letter-spacing: 0.02em;
}
.nav-links { display: flex; gap: 0.15rem; }
.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius);
    font-size: 0.72rem;
    transition: all 0.15s;
}
.nav-links a:hover { color: var(--text); background: var(--surface-hover); }
.nav-links a.active { color: var(--text); background: var(--surface-hover); }

/* ── Container ───────────────────────────────────────────────── */
.container {
    margin: 0 auto;
    padding: 1rem 1.5rem;
}

/* ── Page Header ─────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.page-header h1 {
    font-size: 0.92rem;
    font-weight: 600;
    white-space: nowrap;
}
.page-header .subtitle {
    color: var(--text-muted);
    font-size: 0.72rem;
    margin: 0;
}
.page-header .badge {
    font-size: 0.68rem;
    padding: 0.15rem 0.5rem;
}
.page-header .btn {
    margin-left: auto;
}
h1 { font-size: 0.92rem; font-weight: 600; margin-bottom: 0.25rem; }
.subtitle { color: var(--text-muted); margin-bottom: 0.75rem; font-size: 0.72rem; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
    padding: 0.3rem 0.7rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.7rem;
    transition: all 0.15s;
    font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface-hover); color: var(--text-muted); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); color: var(--text); }
.btn-danger { background: #3a1e25; color: var(--error); border: 1px solid #5a2a35; }
.btn-danger:hover { background: #4a2530; color: #ff7788; }
.btn-danger:disabled { opacity: 0.5; cursor: default; }
.btn-copy {
    background: none; border: none; cursor: pointer; font-size: 0.68rem; padding: 1px 3px;
    opacity: 0.4; transition: opacity 0.15s;
}
.btn-copy:hover { opacity: 1; }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
    background: var(--surface-hover);
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.68rem;
    color: var(--text-muted);
}
.badge-queued { background: #302a18; color: var(--warning); }
.badge-done { background: #213a30; color: var(--success); }
.badge-error { background: #3a1e25; color: var(--error); }
.ws-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin: 0 6px;
    vertical-align: middle;
}
.ws-connected  { background: var(--success); }
.ws-disconnected { background: var(--error); }
.tool-badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.64rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.tool-template { background: #2e2240; color: #b89cda; }
.tool-feature { background: #182e4e; color: #5b8def; }
.tool-surface { background: #213a30; color: #4caf87; }
.tool-chain { background: #3a3118; color: #d4a04a; }
.status-badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.64rem;
    font-weight: 600;
}
.status-badge.status-queued { background: #302a18; color: var(--warning); }
.status-badge.status-processing { background: #182e4e; color: var(--primary); }
.status-badge.status-done { background: #213a30; color: var(--success); }
.status-badge.status-error { background: #3a1e25; color: var(--error); }

/* ── Table ───────────────────────────────────────────────────── */
.tasks-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    border: 1px solid var(--border);
}
.tasks-table th, .tasks-table td {
    text-align: left;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border);
    vertical-align: top;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.72rem;
}
.tasks-table th {
    background: var(--surface);
    color: var(--text-muted);
    font-size: 0.64rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    position: sticky;
    top: 0;
    white-space: nowrap;
    z-index: 1;
}
.tasks-table tbody tr { transition: background 0.1s; }
.tasks-table tbody tr:hover { background: var(--surface-hover); }

.col-uid { width: 110px; }
.col-tool { width: 72px; }
.col-status { width: 72px; }
.col-time { width: 120px; }
.col-duration { width: 75px; }
.duration-cell { text-align: center; font-variant-numeric: tabular-nums; font-size: 0.72rem; color: var(--text-muted); }
.col-input { width: 90px; }
.col-result { width: 90px; }
.col-actions { width: 140px; }

.uid-cell { white-space: nowrap; }
.uid-cell code { font-size: 0.68rem; color: var(--text-muted); font-family: var(--font-mono); }
.images-cell .images-flex { display: flex; gap: 0.3rem; flex-wrap: wrap; align-items: flex-start; }
.actions-cell { vertical-align: middle; }
.actions-flex { display: flex; gap: 0.3rem; }
.btn-action {
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: var(--surface-hover);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.64rem;
    font-family: inherit;
    transition: all 0.15s;
    white-space: nowrap;
}
.btn-action:hover { background: var(--border); color: var(--text); border-color: var(--primary); }
.btn-action:disabled { opacity: 0.3; cursor: default; }
.btn-action:disabled:hover { background: var(--surface-hover); color: var(--text-muted); border-color: var(--border); }
.btn-action-result { color: var(--success); }
.time-cell { white-space: nowrap; font-size: 0.68rem; color: var(--text-muted); }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 0.75rem;
}
.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 26px;
    padding: 0 0.4rem;
    border-radius: var(--radius);
    font-size: 0.68rem;
    text-decoration: none;
    color: var(--text-muted);
    transition: all 0.15s;
}
.pagination a:hover { background: var(--surface-hover); color: var(--text); }
.pagination .active {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}
.pagination .disabled {
    opacity: 0.3;
    pointer-events: none;
}

/* ── Thumbnails ──────────────────────────────────────────────── */
.thumbnail {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 3px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
}
.thumbnail:hover { transform: scale(1.08); border-color: var(--primary); }
.file-link a { color: var(--primary); font-size: 0.68rem; }

/* ── Modal ───────────────────────────────────────────────────── */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
.modal.open { display: flex; }

/* ── JSON Viewer Modal ───────────────────────────────────────── */
.json-modal-dialog {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 90vw;
    max-width: 720px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}
.json-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.8rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}
.json-modal-title {
    font-weight: 600;
    font-size: 0.76rem;
}
.json-modal-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.json-modal-controls .modal-close {
    position: static;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s;
}
.json-modal-controls .modal-close:hover { color: var(--text); }
.json-modal-body {
    overflow: auto;
    flex: 1;
    min-height: 0;
}
.json-modal-img {
    max-width: 100%;
    max-height: 300px;
    display: block;
    margin: 0.75rem auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: border-color 0.15s;
}
.json-modal-img:hover { border-color: var(--primary); }

/* ── Interactive Threshold Viewer ────────────────────────────── */
.viewer-dialog {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 95vw;
    max-width: 1100px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.8rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}
.viewer-title {
    font-weight: 600;
    font-size: 0.76rem;
}
.viewer-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.viewer-controls .modal-close {
    position: static;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s;
}
.viewer-controls .modal-close:hover { color: var(--text); }
.viewer-toolbar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.8rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    font-size: 0.72rem;
}
.viewer-toolbar label { color: var(--text-muted); white-space: nowrap; }
#viewer-slider {
    flex: 1;
    max-width: 400px;
    accent-color: var(--primary);
    cursor: pointer;
}
#viewer-val { color: var(--text); min-width: 2em; }
.viewer-badge {
    font-size: 0.66rem;
    padding: 0.15rem 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    white-space: nowrap;
}
.viewer-canvas-wrap {
    overflow: auto;
    flex: 1;
    min-height: 0;
    background: #000;
}
#viewer-canvas {
    display: block;
    width: 100%;
}
.thumbnail-interactive {
    box-shadow: 0 0 0 2px var(--primary);
    cursor: pointer;
}

.json-view {
    padding: 0.8rem 1rem;
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    line-height: 1.55;
    color: var(--text);
    white-space: pre;
    overflow-x: auto;
}
.json-key { color: #82aaff; }
.json-str { color: #c3e88d; }
.json-num { color: #f78c6c; }
.json-bool { color: #c792ea; }
.json-null { color: var(--text-muted); }

.modal-close {
    position: absolute;
    top: 1rem;
    right: 2rem;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
}
.modal-content { max-width: 90vw; max-height: 90vh; border-radius: var(--radius); }

/* ── Error / Empty ───────────────────────────────────────────── */
.error-text { color: var(--error); font-size: 0.68rem; }
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
    font-size: 0.75rem;
}
.empty-state a { color: var(--primary); }

/* ── Settings Layout ──────────────────────────────────────────── */
.settings-layout {
    display: grid;
    grid-template-columns: minmax(280px, 420px) 1fr;
    gap: 1.25rem;
    align-items: start;
}

/* ── Settings Form ───────────────────────────────────────────── */
.settings-form {
    background: var(--surface);
    padding: 1rem 1.2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.form-group { margin-bottom: 0.85rem; }
.form-group label {
    display: block;
    margin-bottom: 0.2rem;
    font-weight: 500;
    font-size: 0.72rem;
}
.form-group select,
.form-group input[type="number"],
.form-group input[type="text"] {
    width: 100%;
    padding: 0.35rem 0.5rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.72rem;
    font-family: inherit;
}
.form-group input[type="range"] { width: calc(100% - 42px); }
.range-value {
    display: inline-block;
    min-width: 36px;
    text-align: center;
    font-weight: 600;
    font-size: 0.72rem;
    color: var(--primary);
}
.hint { display: block; color: var(--text-muted); font-size: 0.64rem; margin-top: 0.15rem; }

.save-status { margin-left: 0.75rem; font-weight: 500; font-size: 0.72rem; }
.save-status.success { color: var(--success); }
.save-status.error { color: var(--error); }

/* ── Info Card ───────────────────────────────────────────────── */
.info-card {
    background: var(--surface);
    padding: 1rem 1.2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.info-card h3 { margin-bottom: 0.5rem; font-size: 0.78rem; }
.info-card h4 { font-size: 0.72rem; margin-bottom: 0.3rem; }
.info-card a { color: var(--primary); font-size: 0.72rem; }
.info-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0.75rem;
}
.info-table th, .info-table td {
    text-align: left;
    padding: 0.25rem 0.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.7rem;
}
.info-table th { color: var(--text-muted); font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.03em; }

/* ── Code Examples ────────────────────────────────────────────── */
.code-examples { margin-top: 0.75rem; }
.code-examples h4 { font-size: 0.72rem; margin-bottom: 0.3rem; color: var(--text); }
.code-tabs { display: flex; gap: 0; margin-bottom: 0; }
.code-tab {
    padding: 0.2rem 0.6rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-bottom: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.64rem;
    border-radius: var(--radius) var(--radius) 0 0;
    transition: all 0.15s;
    font-family: inherit;
}
.code-tab.active { background: var(--surface-hover); color: var(--text); }
.code-block {
    display: none;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 0.6rem;
    overflow-x: auto;
    margin-bottom: 0.75rem;
}
.code-block.active { display: block; }
.code-block pre {
    font-family: var(--font-mono);
    font-size: 0.64rem;
    line-height: 1.45;
    color: var(--text);
    white-space: pre;
    margin: 0;
}
.code-block pre .cm { color: var(--text-muted); }
.code-block pre .kw { color: #c792ea; }
.code-block pre .str { color: #c3e88d; }
.code-block pre .fn { color: #82aaff; }
.param-table { margin-top: 0.75rem; }
.param-table h4 { font-size: 0.72rem; margin-bottom: 0.3rem; }

/* ── Documentation Page ──────────────────────────────────────── */
.docs { max-width: 1100px; margin: 0 auto; }

.docs-toc {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem 1rem;
    margin-bottom: 1.5rem;
}
.docs-toc h3 { font-size: 0.72rem; margin-bottom: 0.35rem; }
.docs-toc ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; }
.docs-toc a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.7rem;
    transition: color 0.15s;
}
.docs-toc a:hover { color: var(--primary-hover); text-decoration: underline; }

.docs-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}
.docs-section:last-child { border-bottom: none; }
.docs-section h2 {
    font-size: 0.95rem;
    margin-bottom: 0.4rem;
    color: var(--text);
}
.docs-section h3 {
    font-size: 0.8rem;
    margin: 0.8rem 0 0.35rem;
    color: var(--text);
}
.docs-section h4 { font-size: 0.74rem; margin-bottom: 0.2rem; }
.docs-section p {
    font-size: 0.72rem;
    margin-bottom: 0.4rem;
    color: var(--text);
    line-height: 1.55;
}
.docs-section code {
    background: var(--bg);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    font-size: 0.68rem;
    color: var(--primary);
}

.docs-endpoint {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0.6rem 0 0.35rem;
    padding: 0.35rem 0.6rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.docs-endpoint code {
    background: none;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text);
}
.docs-method {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.docs-method.get { background: #182e4e; color: #5b8def; }
.docs-method.post { background: #213a30; color: #4caf87; }
.docs-method.put { background: #302a18; color: #d4a04a; }
.docs-method.delete { background: #3a1e25; color: #d45565; }

.docs-params {
    width: 100%;
    border-collapse: collapse;
    margin: 0.35rem 0 0.75rem;
}
.docs-params th, .docs-params td {
    text-align: left;
    padding: 0.25rem 0.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.68rem;
}
.docs-params th {
    color: var(--text-muted);
    font-size: 0.62rem;
    text-transform: uppercase;
    background: var(--surface);
}

.docs-code {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem;
    margin: 0.35rem 0 0.75rem;
    overflow-x: auto;
}
.docs-code pre {
    font-family: var(--font-mono);
    font-size: 0.64rem;
    line-height: 1.45;
    color: var(--text);
    margin: 0;
    white-space: pre;
}
.docs-code pre .cm { color: var(--text-muted); }

.docs-diagram {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem;
    margin: 0.35rem 0 0.75rem;
    overflow-x: auto;
}
.docs-diagram pre {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    line-height: 1.35;
    color: var(--text-muted);
    margin: 0;
    white-space: pre;
}

/* ── Architecture Diagram ────────────────────────────────────── */
.arch-diagram {
    margin: 0.75rem 0 1rem;
    padding: 1.2rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}
.arch-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}
.arch-row-mid { gap: 1.2rem; }
.arch-row-workers { gap: 0.5rem; flex-wrap: wrap; }
.arch-node {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 0.8rem;
    text-align: center;
    min-width: 100px;
    transition: border-color 0.15s;
}
.arch-node:hover { border-color: var(--primary); }
.arch-icon { font-size: 1.2rem; margin-bottom: 0.1rem; }
.arch-label { font-size: 0.74rem; font-weight: 600; color: var(--text); }
.arch-port { font-size: 0.62rem; font-family: var(--font-mono); color: var(--primary); margin-top: 0.1rem; }
.arch-desc { font-size: 0.6rem; color: var(--text-muted); margin-top: 0.15rem; }

.arch-client { border-color: var(--text-muted); }
.arch-nginx { border-left: 2px solid var(--success); }
.arch-api { border-left: 2px solid var(--primary); }
.arch-redis { border-left: 2px solid var(--error); }
.arch-volume { border-left: 2px solid var(--warning); border-style: dashed; border-width: 1px; border-left-width: 2px; }

.arch-worker { min-width: 120px; }
.arch-w-template { border-left: 2px solid #b89cda; }
.arch-w-feature { border-left: 2px solid #5b8def; }
.arch-w-surface { border-left: 2px solid #4caf87; }
.arch-w-chain { border-left: 2px solid #d4a04a; }

/* Horizontal arrow */
.arch-arrow-h {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 0.1rem;
    min-width: 50px;
}
.arch-arrow-h::before {
    content: '';
    display: block;
    width: 100%;
    height: 0;
    border-top: 1.5px solid var(--text-muted);
    position: relative;
}
.arch-arrow-h::after {
    content: '';
    position: absolute;
    right: -1px;
    top: 50%;
    width: 0; height: 0;
    border-left: 5px solid var(--text-muted);
    border-top: 3px solid transparent;
    border-bottom: 3px solid transparent;
}
.arch-arrow-h {
    position: relative;
    height: 20px;
    justify-content: center;
}
.arch-arrow-h span {
    font-size: 0.56rem;
    color: var(--text-muted);
    position: absolute;
    top: -10px;
    white-space: nowrap;
}

/* Vertical arrow */
.arch-arrow-v {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    height: 32px;
    width: 1px;
    background: var(--text-muted);
    margin: 0 auto;
}
.arch-arrow-v::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 0; height: 0;
    border-top: 5px solid var(--text-muted);
    border-left: 3px solid transparent;
    border-right: 3px solid transparent;
}
.arch-arrow-v span {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.58rem;
    color: var(--text-muted);
    white-space: nowrap;
    font-style: italic;
}

/* ── Flow Diagram (lifecycle) ────────────────────────────────── */
.flow-diagram {
    display: flex;
    align-items: stretch;
    gap: 0;
    margin: 0.75rem 0 1rem;
    padding: 0.8rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
}
.flow-step {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    padding: 0.5rem 0.6rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 120px;
    flex-shrink: 0;
    transition: border-color 0.15s;
}
.flow-step:hover { border-color: var(--primary); }
.flow-num {
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    font-weight: 700;
    flex-shrink: 0;
}
.flow-title { font-weight: 600; font-size: 0.7rem; margin-bottom: 0.15rem; }
.flow-text { font-size: 0.62rem; color: var(--text-muted); line-height: 1.45; }
.flow-text code { font-size: 0.6rem; }
.flow-arrow-h {
    display: flex;
    align-items: center;
    padding: 0 0.2rem;
    flex-shrink: 0;
    position: relative;
    width: 24px;
}
.flow-arrow-h::before {
    content: '';
    display: block;
    width: 100%;
    height: 0;
    border-top: 1.5px solid var(--border);
}
.flow-arrow-h::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0; height: 0;
    border-left: 5px solid var(--border);
    border-top: 3px solid transparent;
    border-bottom: 3px solid transparent;
}

/* ── Sequence Diagram (webhooks) ─────────────────────────────── */
.seq-diagram {
    margin: 0.75rem 0 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.8rem 1rem;
    overflow-x: auto;
}
.seq-header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 0.4rem;
}
.seq-actor {
    text-align: center;
    font-weight: 600;
    font-size: 0.72rem;
    padding: 0.3rem 0.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg);
}
.seq-actor-client { border-left: 2px solid var(--text-muted); }
.seq-actor-aero { border-left: 2px solid var(--primary); }
.seq-actor-server { border-left: 2px solid var(--success); }

.seq-body {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    position: relative;
    padding: 0.5rem 0;
}
.seq-lifelines {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    pointer-events: none;
}
.seq-lifeline {
    width: 1px;
    background: var(--border);
    margin: 0 auto;
    height: 100%;
    opacity: 0.5;
}

.seq-msg {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 0.15rem 2rem;
}
.seq-msg-line {
    width: 80%;
    height: 0;
    border-top: 1.5px solid var(--primary);
    position: relative;
}
.seq-msg-right .seq-msg-line::after {
    content: '';
    position: absolute;
    right: -1px;
    top: -3.5px;
    width: 0; height: 0;
    border-left: 5px solid var(--primary);
    border-top: 3px solid transparent;
    border-bottom: 3px solid transparent;
}
.seq-msg-left .seq-msg-line {
    border-top-style: dashed;
    border-color: var(--success);
}
.seq-msg-left .seq-msg-line::after {
    content: '';
    position: absolute;
    left: -1px;
    top: -3.5px;
    width: 0; height: 0;
    border-right: 5px solid var(--success);
    border-top: 3px solid transparent;
    border-bottom: 3px solid transparent;
}
.seq-msg-label {
    font-size: 0.64rem;
    color: var(--text);
    margin-top: 0.1rem;
}
.seq-msg-label code { font-size: 0.62rem; background: none; padding: 0; }
.seq-msg-resp {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.6rem;
}
.seq-msg-detail {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.05rem;
    padding: 0 2rem;
}
.seq-msg-detail span {
    font-size: 0.58rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}
.seq-note {
    text-align: center;
    font-size: 0.62rem;
    font-style: italic;
    color: var(--warning);
    padding: 0.2rem 0.5rem;
    border: 1px dashed var(--warning);
    border-radius: var(--radius);
    background: #302a1810;
    margin: 0.15rem auto;
    width: fit-content;
}
.seq-spacer { height: 0.3rem; }

.docs-steps {
    padding-left: 1.2rem;
    margin: 0.35rem 0 0.75rem;
}
.docs-steps li { font-size: 0.72rem; margin-bottom: 0.2rem; }

.docs-note {
    background: #302a18;
    border-left: 2px solid var(--warning);
    padding: 0.4rem 0.6rem;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 0.68rem;
}

.docs-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1rem 0;
}

.docs-scenario-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.75rem;
    margin: 0.75rem 0;
}
.docs-scenario {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.15s;
}
.docs-scenario:hover { border-color: var(--primary); }
.docs-scenario-img {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}
.docs-img-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    color: var(--text-muted);
}
.docs-img-placeholder span { font-size: 1.4rem; }
.docs-img-placeholder small { font-size: 0.62rem; }
.docs-img-placeholder.wide {
    flex-direction: row;
    gap: 0.6rem;
    padding: 0.6rem;
}
.docs-scenario-text { padding: 0.6rem; }
.docs-scenario-text h4 { font-size: 0.72rem; margin-bottom: 0.2rem; }
.docs-scenario-text p {
    font-size: 0.66rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}
.docs-scenario-text code {
    display: block;
    font-size: 0.62rem;
    padding: 0.2rem 0.4rem;
    background: var(--bg);
    border-radius: 3px;
    color: var(--primary);
}
.docs-result-img {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem;
    margin: 0.35rem 0 0.75rem;
    display: flex;
    justify-content: center;
}

/* ── Example images ──────────────────────────────────────────── */
.example-images {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    align-items: flex-start;
    margin: 0.75rem 0;
}
.example-fig {
    margin: 0;
    text-align: center;
    flex: 1;
    min-width: 0;
}
.example-fig img {
    max-width: 100%;
    max-height: 180px;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s;
}
.example-fig img:hover {
    border-color: var(--primary);
    transform: scale(1.03);
}
.example-fig figcaption {
    font-size: 0.62rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}
.docs-result-img img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
}
