/* ==========================================================================
   INTEGRATIONS - THE INBOUND TAB (docs/claude/ACTIONS.md section 19; /actions/inbound)

   The signed inbound webhooks: the list (each address with Copy, its signing and secret pills, routes, what waits),
   the set-up steps and the delivery log, the listener editor. This stylesheet owns every inbound-* class
   (Tests/ConversationBuilderCssOwnershipTests); it wears studio.css's list frame and conv-builder.css's dialog and
   never restyles a studio-* or conv-* class unscoped. Colours are tokens only (--theme-*, --conv-*, --wf-*), so a
   tenant theme - a dark one included - re-skins it for free.
   ========================================================================== */

/* ── The list ───────────────────────────────────────────────────────────── */

.inbound-endpoints {
    margin: 0;
    padding: 0;
    list-style: none;
}

.inbound-endpoint {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--wf-line);
    transition: background-color var(--conv-motion);
}

.inbound-endpoint:last-child {
    border-bottom: 0;
}

.inbound-endpoint.is-selected {
    background: var(--theme-background-subtle);
    box-shadow: inset 3px 0 0 var(--conv-act);
}

.inbound-endpoint-body {
    flex: 1 1 auto;
    min-width: 0;
}

.inbound-url-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    margin-top: 4px;
}

.inbound-url {
    overflow: hidden;
    padding: 2px 8px;
    border: 1px solid var(--theme-border-subtle);
    border-radius: var(--wf-radius-xs);
    background: var(--theme-background-raised);
    color: var(--theme-text-secondary);
    font-size: var(--theme-font-size-xs);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inbound-head-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

/* ── One webhook: the set-up steps, the fields, the log ─────────────────── */

.inbound-log {
    margin-top: 16px;
}

.inbound-setup {
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-bottom: 1px solid var(--wf-line);
}

.inbound-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.inbound-step-n {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: var(--wf-radius-pill);
    background: var(--wf-primary-soft);
    color: var(--wf-primary-ink);
    font-size: var(--theme-font-size-xs);
    font-weight: 600;
}

.inbound-step-grow {
    flex: 1 1 auto;
    min-width: 0;
}

.inbound-step-title {
    color: var(--theme-text-emphasis);
    font-size: var(--theme-font-size-sm);
    font-weight: 600;
}

.inbound-route-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 6px 0 0;
    padding: 0;
    list-style: none;
}

.inbound-route-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    padding: 6px 8px;
    border: 1px solid var(--theme-border-subtle);
    border-radius: var(--wf-radius-sm);
    font-size: var(--theme-font-size-sm);
}

.inbound-route-events {
    color: var(--theme-text-secondary);
}

.inbound-route-arm {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-left: auto;
}

.inbound-secret-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    max-width: 520px;
    margin-top: 6px;
}

.inbound-secret-row .conv-input {
    flex: 1 1 240px;
    min-width: 0;
}

.inbound-sample {
    border-bottom: 1px solid var(--wf-line);
}

.inbound-sample-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.inbound-error {
    color: var(--wf-danger-ink);
}

.inbound-fields,
.inbound-deliveries {
    margin-bottom: 0;
}

.inbound-cell-clip {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── The editor ─────────────────────────────────────────────────────────── */

.inbound-dialog {
    display: flex;
    flex-direction: column;
    width: min(720px, 100%);
    max-height: calc(100vh - 48px);
}

.inbound-dialog-body {
    min-height: 0;
    overflow: auto;
}

.inbound-gap-top {
    margin-top: 12px;
}

.inbound-routes-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.inbound-route {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 8px 0 0;
    padding: 12px;
    border: 1px solid var(--theme-border-subtle);
    border-radius: var(--theme-radius);
    background: var(--theme-background-raised);
}

.inbound-route-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.inbound-route-cell {
    flex: 1 1 0;
    min-width: 0;
}

.inbound-route-remove {
    flex: 0 0 auto;
    color: var(--theme-text-secondary);
}

.inbound-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    color: var(--theme-text);
    font-size: var(--theme-font-size-sm);
}

.inbound-advanced {
    margin-top: 12px;
    padding: 8px 12px;
    border: 1px solid var(--theme-border-subtle);
    border-radius: var(--theme-radius);
}

.inbound-advanced > summary {
    color: var(--theme-text-emphasis);
    font-size: var(--theme-font-size-sm);
    font-weight: 600;
    cursor: pointer;
}

/* ── Touch, narrow screens, reduced motion ──────────────────────────────── */

@media (pointer: coarse) {
    .inbound-route-remove {
        min-width: 44px;
        min-height: 44px;
    }
}

@media (max-width: 860px) {
    .inbound-endpoint {
        flex-wrap: wrap;
    }

    .inbound-route-row {
        flex-direction: column;
        align-items: stretch;
    }

    .inbound-cell-clip {
        max-width: none;
        white-space: normal;
        word-break: break-all;
    }
}

@media (prefers-reduced-motion: reduce) {
    .inbound-endpoint {
        transition: none;
    }
}
